mutmut 3.0.1__tar.gz → 3.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mutmut-3.0.1 → mutmut-3.0.2}/HISTORY.rst +8 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/PKG-INFO +1 -1
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut/__init__.py +1 -1
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut/__main__.py +16 -6
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut.egg-info/PKG-INFO +1 -1
- mutmut-3.0.2/mutmut.egg-info/entry_points.txt +2 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/setup.py +1 -1
- {mutmut-3.0.1 → mutmut-3.0.2}/tests/test_mutation.py +1 -1
- mutmut-3.0.1/mutmut.egg-info/entry_points.txt +0 -2
- {mutmut-3.0.1 → mutmut-3.0.2}/AUTHORS.rst +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/LICENSE +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/MANIFEST.in +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/README.rst +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut/result_browser_layout.tcss +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut.egg-info/SOURCES.txt +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut.egg-info/dependency_links.txt +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut.egg-info/not-zip-safe +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut.egg-info/requires.txt +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/mutmut.egg-info/top_level.txt +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/requirements.txt +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/setup.cfg +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/test_requirements.txt +0 -0
- {mutmut-3.0.1 → mutmut-3.0.2}/tests/test_mutmut3.py +0 -0
|
@@ -43,7 +43,10 @@ from typing import (
|
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
import click
|
|
46
|
-
from parso import
|
|
46
|
+
from parso import (
|
|
47
|
+
parse,
|
|
48
|
+
ParserSyntaxError,
|
|
49
|
+
)
|
|
47
50
|
from setproctitle import setproctitle
|
|
48
51
|
|
|
49
52
|
import mutmut
|
|
@@ -181,10 +184,10 @@ def _mutmut_trampoline(orig, mutants, *args, **kwargs):
|
|
|
181
184
|
import os
|
|
182
185
|
mutant_under_test = os.environ['MUTANT_UNDER_TEST']
|
|
183
186
|
if mutant_under_test == 'fail':
|
|
184
|
-
from __main__ import MutmutProgrammaticFailException
|
|
187
|
+
from mutmut.__main__ import MutmutProgrammaticFailException
|
|
185
188
|
raise MutmutProgrammaticFailException('Failed programmatically')
|
|
186
189
|
elif mutant_under_test == 'stats':
|
|
187
|
-
from __main__ import record_trampoline_hit
|
|
190
|
+
from mutmut.__main__ import record_trampoline_hit
|
|
188
191
|
record_trampoline_hit(orig.__module__ + '.' + orig.__name__)
|
|
189
192
|
return orig(*args, **kwargs)
|
|
190
193
|
prefix = orig.__module__ + '.' + orig.__name__ + '__mutmut_'
|
|
@@ -239,7 +242,7 @@ def create_mutants_for_file(filename, output_path):
|
|
|
239
242
|
source = f.read()
|
|
240
243
|
|
|
241
244
|
with open(output_path, 'w') as out:
|
|
242
|
-
mutant_names, hash_by_function_name = write_all_mutants_to_file(out=out, source=source)
|
|
245
|
+
mutant_names, hash_by_function_name = write_all_mutants_to_file(out=out, source=source, filename=filename)
|
|
243
246
|
|
|
244
247
|
# validate no syntax errors of mutants
|
|
245
248
|
with open(output_path) as f:
|
|
@@ -269,13 +272,20 @@ def ensure_ends_with_newline(source):
|
|
|
269
272
|
return source
|
|
270
273
|
|
|
271
274
|
|
|
272
|
-
def write_all_mutants_to_file(*, out, source):
|
|
275
|
+
def write_all_mutants_to_file(*, out, source, filename):
|
|
273
276
|
no_mutate_lines = pragma_no_mutate_lines(source)
|
|
274
277
|
|
|
275
278
|
hash_by_function_name = {}
|
|
276
279
|
mutant_names = []
|
|
277
280
|
|
|
278
|
-
|
|
281
|
+
try:
|
|
282
|
+
ast = parse(ensure_ends_with_newline(source), error_recovery=False)
|
|
283
|
+
except ParserSyntaxError:
|
|
284
|
+
print(f'Warning: unsupported syntax in {filename}, skipping')
|
|
285
|
+
out.write(source)
|
|
286
|
+
return [], {}
|
|
287
|
+
|
|
288
|
+
for type_, x, name_and_hash, mutant_name in yield_mutants_for_module(ast, no_mutate_lines):
|
|
279
289
|
out.write(x)
|
|
280
290
|
if mutant_name:
|
|
281
291
|
mutant_names.append(mutant_name)
|
|
@@ -313,7 +313,7 @@ class Foo:
|
|
|
313
313
|
""".strip()
|
|
314
314
|
|
|
315
315
|
out = StringIO()
|
|
316
|
-
mutant_names, hash_by_function_name = write_all_mutants_to_file(out=out, source=source)
|
|
316
|
+
mutant_names, hash_by_function_name = write_all_mutants_to_file(out=out, source=source, filename='filename')
|
|
317
317
|
assert len(mutant_names) == 2
|
|
318
318
|
mutants_source = out.getvalue()
|
|
319
319
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|