Run a file's mutants at the same time in symlink overlays.

Each worker keeps a private copy of the file under test and links the rest of the project, so the original tree stays put. The default is one worker per core, and --max-workers can set a lower cap.
This commit is contained in:
Robert C. Martin
2026-09-30 15:23:42 -05:00
parent 63fe452adb
commit 21d6d6f50b
8 changed files with 524 additions and 44 deletions
+13 -1
View File
@@ -1,4 +1,6 @@
from mutator.runner import _clojure_command, _python_command, nearest
import sys
from mutator.runner import CommandRunner, _clojure_command, _python_command, nearest
def test_nearest_walks_up_to_the_marker(tmp_path):
@@ -66,3 +68,13 @@ def test_python_commands(tmp_path):
conf.mkdir()
(conf / "conftest.py").write_text("", encoding="utf-8")
assert _python_command(conf).endswith("-m pytest")
def test_a_worker_overlay_is_imported_ahead_of_the_environment(tmp_path):
worker = tmp_path / "target" / "mutation-workers" / "run-1" / "worker-0"
(worker / "src").mkdir(parents=True)
(worker / "src" / "demo.py").write_text("VALUE = 'worker'\n", encoding="utf-8")
command = f"{sys.executable} -c 'import demo; print(demo.VALUE)'"
result = CommandRunner().run(command, worker, 5)
assert result.code == 0
assert result.output.strip() == "worker"