Leave out a failing test file by its absolute path, since pytest 9.2 under mutmut 3.8.1 reports nodeids as mutants/<path>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""The setup.cfg that has mutmut mutate a branch's changed files, and the tests left out because they fail before any mutant."""
|
||||
import configparser
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
|
||||
from failure import Failure
|
||||
@@ -44,8 +45,14 @@ def listed(items: list[str]) -> str:
|
||||
|
||||
|
||||
def left_out(output: str) -> list[str]:
|
||||
"""The pytest options that leave out each test a failed run's short summary reports: --deselect for a test, --ignore for a file that failed to collect."""
|
||||
"""The nodeid of each test, or test file that failed to collect, that a failed run's short summary reports."""
|
||||
summary = SUMMARY.split(output)
|
||||
if len(summary) < 2:
|
||||
return []
|
||||
return [f"--deselect={nodeid}" if "::" in nodeid else f"--ignore={nodeid}" for nodeid in REPORTED.findall(summary[-1])]
|
||||
return REPORTED.findall(summary[-1]) if len(summary) > 1 else []
|
||||
|
||||
|
||||
def leaving_out(nodeids: list[str], copy: str) -> list[str]:
|
||||
"""The pytest options that leave out each nodeid: --deselect for a test, --ignore for a file.
|
||||
|
||||
mutmut 3.8.1 runs pytest in copy's mutants/ folder, yet pytest 9.2 reports each nodeid from copy, as mutants/<path>. --deselect takes the
|
||||
nodeid as reported, and --ignore an absolute path, built the same way whether or not the nodeid starts with mutants/."""
|
||||
return [f"--deselect={nodeid}" if "::" in nodeid else f"--ignore={os.path.join(copy, 'mutants', nodeid.removeprefix('mutants/'))}" for nodeid in nodeids]
|
||||
|
||||
Reference in New Issue
Block a user