test: harden process and TUI synchronization - #4
Merged
Conversation
dejay-vu
marked this pull request as ready for review
July 14, 2026 22:19
There was a problem hiding this comment.
Pull request overview
This PR hardens timing- and OS-error-sensitive test helpers by making process-exit probing distinguish “process is gone” from “probe failed”, and by synchronizing a TUI test with the GC preview confirmation modal before asserting on it.
Changes:
- Reject non-positive PIDs and treat only
ProcessLookupErroras a definitive “process exited” signal duringos.kill(pid, 0)probing. - Fail explicitly when
os.kill(pid, 0)raises otherOSErrorsubclasses (e.g., permission/probing errors) instead of silently passing. - Add an explicit async wait for the
ConfirmModalscreen before inspecting/clicking it in the GC preview TUI test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/unit/test_env_executors.py | Tightens process-exit polling to avoid false positives and unsafe PID values in unit tests. |
| tests/tui/test_pilot.py | Adds explicit modal synchronization to prevent a race when asserting against the GC confirmation UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
ProcessLookupErroras evidence that the process is goneos.kill(pid, 0)raises anotherOSErrorWhy
The process-exit helper follows up on Copilot feedback from PR #3: catching every
OSErrorcould incorrectly pass when a process still existed but could not beinspected. The Python 3.14 check also exposed a separate TUI race where the test
could inspect the screen before the GC callback had pushed the confirmation
modal.
Impact
Production behavior is unchanged. These tests now distinguish a missing process
from a failed process probe and synchronize with both the GC callback and modal
mounting before making assertions.
Validation
conda run -n slurmdeck-dev ruff format .conda run -n slurmdeck-dev ruff check .conda run -n slurmdeck-dev mypyconda run -n slurmdeck-dev python -m pytest -q(510 passed)git diff --check