Skip to content

Commit e40eee5

Browse files
committed
fix: wait for the stdout-filter thread in test_def_via_stdout_fails_session_action_on_error
The test asserted the parse-error log message immediately after observing the session leave RUNNING, but the message is emitted by the subprocess stdout-filter thread, which can still be draining the pipe at that point. The race is intermittent on Windows CI (observed repeatedly on python 3.9/3.14 windows-latest runners), where it fails with the message absent from caplog and then passes on re-run. Poll briefly for the message instead of racing the thread. Signed-off-by: andychoquette <78888816+andychoquette@users.noreply.github.com>
1 parent ea87e9c commit e40eee5

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

test/openjd/sessions_v0/test_session.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,10 +3027,16 @@ def test_def_via_stdout_fails_session_action_on_error(
30273027

30283028
# THEN
30293029
assert session.state == SessionState.READY_ENDING
3030-
assert (
3030+
# The error is logged by the subprocess stdout-filter thread, which can
3031+
# still be draining the pipe when the state transition is observed above.
3032+
# Wait for the message rather than racing that thread.
3033+
expected_message = (
30313034
"openjd_env: FOO -- ERROR: Failed to parse environment variable assignment."
3032-
in caplog.messages
30333035
)
3036+
deadline = time.monotonic() + 5
3037+
while expected_message not in caplog.messages and time.monotonic() < deadline:
3038+
time.sleep(0.1)
3039+
assert expected_message in caplog.messages
30343040

30353041
callback.assert_has_calls(
30363042
[

0 commit comments

Comments
 (0)