Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tests/test_remote_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def start(command, **kwargs):
return Process()

monkeypatch.setattr(job.subprocess, "Popen", start)
monkeypatch.setattr(job.os, "killpg", lambda *args: calls.append(args))
# raising=False: neither os.killpg nor signal.SIGKILL exists on Windows.
# execute() only ever runs for real inside a Linux remote worker; both are
# faked here so the supervisor's timeout/cleanup logic can be verified
# from any host OS.
monkeypatch.setattr(job.os, "killpg", lambda *args: calls.append(args), raising=False)
monkeypatch.setattr(job.signal, "SIGKILL", 9, raising=False)
monkeypatch.setattr(job, "_cleanup_containers", lambda token: {"passed": True, "removed": 1})
with pytest.raises(subprocess.TimeoutExpired):
job.execute(tmp_path, ["remote-test-fixture"], timeout_sec=1)
Expand Down