Repository navigation
test(background): add process lifecycle, polling, and PID validation tests - #111
Open
chiragjangiir wants to merge 1 commit into
Open
chiragjangiir wants to merge 1 commit into
chiragjangiir wants to merge 1 commit into
Conversation
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.
Closes #72
Summary
This PR addresses issue #72 by adding comprehensive unit test coverage for
devagent/background/jobs.py.Changes
devagent/background/jobs.py:_is_running, added a guard forpid <= 0returningFalse. On POSIX systems, callingos.kill(0, 0)checks if the calling process group is alive, which would incorrectly report invalid/dummy PID 0 as running.tests/test_background_jobs.py):test_is_running_invalid_pid: tests that PID0and negative PIDs are safely identified as not running.test_launch_creates_state_and_log_files: tests state and log initialization upon job launch.test_poll_running_process: tests poll state when a background process is still active.test_poll_exit_zero: tests exit state resolution and file persistence when the process exits cleanly.test_poll_exit_nonzero: tests exit state resolution when the process fails with non-zero code.test_poll_exit_no_journal: tests fallback tounknownwhen no exit journal file exists.test_list_jobs_empty&test_list_jobs_mixed: tests listing multiple background jobs in varying states.Verification
pytest tests/test_background_jobs.py(11/11 tests pass in 0.06s).