Run mutate-changes on a script its tests import by file name, and name a crash inside mutmut in one line
This commit is contained in:
@@ -58,6 +58,9 @@ else:
|
||||
if mode == "setup-fault":
|
||||
print("Stopping early, because tests recorded trampoline hits but none match any mutant key. This usually means imports bypass the mutants.")
|
||||
sys.exit(1)
|
||||
if mode == "crash":
|
||||
print("Traceback (most recent call last):\n File \"/uv/site-packages/mutmut/__main__.py\", line 1050, in _run\n File \"/uv/site-packages/mutmut/workers/isolation.py\", line 889, in wait_for_result\nKeyError: 974598")
|
||||
sys.exit(1)
|
||||
"""
|
||||
# cargo-mutants, Infection and Stryker, which log the folder they run in and how they were called, and exit with the code the test
|
||||
# gives. cargo-mutants also logs the diff it is given and writes its outcome files, all but unviable.txt, as a run without an
|
||||
@@ -205,6 +208,10 @@ class MutateChangesRuns(unittest.TestCase):
|
||||
ran = self.run_tool(*self.faked("no-test"))
|
||||
self.assertEqual(ran.stdout.splitlines()[:3], ["mutmut in pkg: 2 mutants on changed lines, 2 not killed. No test reaches them.", "pkg/calc.py:6: no tests: return n * 4", "pkg/calc.py:6: no tests: return n / 3"], ran.stderr)
|
||||
|
||||
def test_a_crash_inside_mutmut_fails_the_run_in_one_line_naming_mutmut_and_the_error(self):
|
||||
ran = self.run_tool(*self.faked("crash"))
|
||||
self.assertEqual((ran.returncode, ran.stderr), (1, "mutmut crashed in pkg with KeyError: 974598, in mutmut/workers/isolation.py line 889: mutate the changed lines of pkg by hand.\n"))
|
||||
|
||||
def test_a_run_that_stops_early_for_another_reason_fails_the_run(self):
|
||||
ran = self.run_tool(*self.faked("setup-fault"))
|
||||
self.assertEqual((ran.returncode, ran.stderr.splitlines()[0]), (1, "mutmut run in pkg exited 1:"))
|
||||
|
||||
Reference in New Issue
Block a user