Answer stability round 1: 0 🔴, 3 🟡 (0 misread); mutmut's copy keeps a link to a folder, the README place waits for item 300, and CRLF files are item 530

This commit is contained in:
2026-11-23 22:31:03 +01:00
parent 04c1778d57
commit c43d9e9bae
4 changed files with 35 additions and 11 deletions
+6 -5
View File
@@ -46,13 +46,13 @@ class Folder:
@dataclasses.dataclass(frozen=True)
class Ended:
"""How mutmut's run in a folder ended. found is empty where the folder has no mutant, as none says why, or where mutmut crashed, as crash says how."""
"""How mutmut's run in a folder ended. `found` is empty in two cases: the folder has no mutant, and `none` says why; or mutmut crashed, and `crash` says how."""
folder: Folder
found: dict[str, str] = dataclasses.field(default_factory=dict) # each mutant's status by mutmut's name of it
copies: dict[str, str] = dataclasses.field(default_factory=dict) # mutmut's mutants/ copy of each of the folder's files it wrote one for
none: str = ""
crash: str = ""
notes: str = "" # what the run left out, for the report
notes: str = "" # the end of the report's line: that no test reaches the mutants, and the tests left out
class Located(typing.NamedTuple):
@@ -64,7 +64,7 @@ class Located(typing.NamedTuple):
class Killed(typing.NamedTuple):
"""A mutant the tests kill, by mutmut's name of it, with its file's path from the top and the lines it changes."""
"""A mutant mutmut reports as caught, by the tests or its type check, by mutmut's name of it, with its file's path from the top and the lines it changes."""
path: str
name: str
change: Change
@@ -97,7 +97,8 @@ def killed_by_mutmut(top: str, paths: list[str], run: Run, jobs: int) -> list[Ki
killed: list[Killed] = []
for path, files in sorted(imported_by_file_name(top, by_folder(top, lines, CONFIGS), CONFIGS).items()):
root = os.path.join(top, path)
listed = [os.path.relpath(os.path.join(folder, name), root) for folder, _, names in os.walk(root) for name in names]
# os.walk lists a link to a folder among the folders and doesn't enter it; the copy keeps it as a link, as it keeps one git lists.
listed = [os.path.relpath(os.path.join(folder, name), root) for folder, folders, names in os.walk(root) for name in [*names, *(name for name in folders if os.path.islink(os.path.join(folder, name)))]]
ended = mutate_folder(top, path, files, listed, run, jobs)
if isinstance(ended, Failure) or ended.crash:
return ended if isinstance(ended, Failure) else Failure(f"mutmut in {ended.folder.label} crashed with {ended.crash}")
@@ -106,7 +107,7 @@ def killed_by_mutmut(top: str, paths: list[str], run: Run, jobs: int) -> list[Ki
def mutate_folder(top: str, path: str, files: dict[str, frozenset[int]], listed: list[str], run: Run, jobs: int) -> Ended | Failure:
"""Runs mutmut over the functions and methods the lines of files fall in, in a scratch copy of the folder at path that holds the files listed."""
"""Runs mutmut over the functions and methods that the lines in `files` fall in. It runs in a scratch copy of the folder at `path`, and the copy holds the files in `listed`."""
root = os.path.join(top, path)
folder = read_folder(root, path, files)
if isinstance(folder, Failure):