Tell a Rust file's test modules apart as bytes and kill the surviving mutants
CI / tests (pull_request) Failing after 5m15s

This commit is contained in:
2026-11-26 00:00:33 +01:00
parent c794073312
commit dd15690903
5 changed files with 106 additions and 54 deletions
+2 -3
View File
@@ -196,9 +196,8 @@ def keep_rust_tests(planted_file: str, target: str) -> None:
Raises OSError where a file cannot be read or written."""
if os.path.islink(planted_file) or os.path.islink(target) or not os.path.isfile(planted_file):
return
# A Rust file is UTF-8; a byte that isn't survives the round trip.
planted, copied = (pathlib.Path(file).read_bytes().decode("utf-8", "surrogateescape") for file in (planted_file, target))
pathlib.Path(target).write_bytes(with_tests_of(planted, copied).encode("utf-8", "surrogateescape"))
planted, copied = (pathlib.Path(file).read_bytes() for file in (planted_file, target))
pathlib.Path(target).write_bytes(with_tests_of(planted, copied))
def of_tests(path: str) -> bool: