Parse each mutants/ copy once when reporting mutmut's mutants, and kill more survivors with tests of by_folder, the in-diff tools' folder and their start failures
This commit is contained in:
@@ -9,7 +9,7 @@ import unittest
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from mutate_changes.changed_lines import added_lines, runs, tool_for
|
||||
from mutate_changes.mutmut_tool import copy_files
|
||||
from mutate_changes.mutmut_tool import by_folder, copy_files
|
||||
from failure import Failure
|
||||
from mutate_changes.mutmut_mutants import function_keys, mutant_globs, mutated_line, named, statuses
|
||||
from mutate_changes.mutmut_setup import left_out, mutmut_config
|
||||
@@ -162,6 +162,15 @@ class MutmutMutants(unittest.TestCase):
|
||||
|
||||
|
||||
class MutmutTool(unittest.TestCase):
|
||||
def test_each_file_goes_to_the_nearest_folder_above_it_that_sets_python_up(self):
|
||||
with tempfile.TemporaryDirectory() as top:
|
||||
for config in ("pkg/setup.cfg", "pkg/inner/lib/pyproject.toml"):
|
||||
pathlib.Path(top, config).parent.mkdir(parents=True)
|
||||
pathlib.Path(top, config).write_text("")
|
||||
lines = frozenset({1})
|
||||
grouped = by_folder(top, {"pkg/inner/deep.py": lines, "pkg/inner/lib/x.py": lines, "top.py": lines})
|
||||
self.assertEqual(grouped, {"pkg": {"inner/deep.py": lines}, "pkg/inner/lib": {"x.py": lines}, ".": {"top.py": lines}})
|
||||
|
||||
def test_copy_files_copies_what_is_listed_but_mutmuts_own_folders_and_names_the_entries_at_the_top(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
root, copy = pathlib.Path(temp, "root"), pathlib.Path(temp, "copy")
|
||||
|
||||
Reference in New Issue
Block a user