tests: fake os.killpg/signal.SIGKILL for Windows in remote-job test - #140
Open
KNambiarDJsc wants to merge 1 commit into
Open
KNambiarDJsc wants to merge 1 commit into
KNambiarDJsc wants to merge 1 commit into
Conversation
test_timeout_terminates_process_group_and_its_owned_containers mocks both Popen and killpg to exercise execute()'s timeout/cleanup state machine without touching a real OS. Neither os.killpg nor signal.SIGKILL exists on Windows, so monkeypatch.setattr's default raising=True failed before the fake was even installed. execute() only ever runs for real inside a Linux remote worker (REPO2RLENV_REMOTE_WORKER=1, killpg needs a POSIX process group), so this doesn't change production code — it lets the existing coverage of that logic run from a Windows host too, same shape as the os.chown guards in huggingface#136.
KNambiarDJsc
force-pushed
the
fix/remote-job-test-windows-attrs
branch
from
September 17, 2026 08:46
991fb47 to
7033a98
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Continuing the Windows-portability triage from #130.
test_timeout_terminates_process_group_and_its_owned_containersmocks bothPopenandkillpgto exerciseexecute()'s timeout/cleanup state machine without touching a real OS — butmonkeypatch.setattr's defaultraising=Truerequires the target attribute to already exist, and neitheros.killpgnorsignal.SIGKILLexists on Windows at all. The test failed before its fake was even installed:and, after patching that, a second one:
execute()only ever runs for real inside a Linux remote worker (REPO2RLENV_REMOTE_WORKER=1;killpgneeds a POSIX process group), so this doesn't touch production code — same reasoning as theos.chownguards in #136, just withraising=Falseletting the existing fakes install cleanly and the test verify the real cleanup logic from any host OS.Test plan
uv run pytest tests/test_remote_job.py -q— 3 passed (was 1 failed before this change)uv run ruff check/ruff format --checkon the touched filetest_remote_job.pyno longer appears in the Windows failure set)