Skip to content

Commit

Permalink
Fix pytest caplog heisenbug introduced in PR #3559 (#3565)
Browse files Browse the repository at this point in the history
Prior to this PR, this usage of caplog is dependent on the level of
the root logger, which is not set by this test and so ends up being
dependent on which tests have run before: sometimes the INFO logs
output by htex.shutdown are not captured by caplog.

This PR explicitly tells caplog to get at least INFO level logs, to
capture the expected messages.
  • Loading branch information
benclifford authored Aug 3, 2024
1 parent 4f139c2 commit 2f6a185
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion parsl/tests/test_htex/test_htex.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import pathlib
from subprocess import Popen, TimeoutExpired
from typing import Optional, Sequence
Expand Down Expand Up @@ -107,7 +108,8 @@ def kill_interchange(*args, **kwargs):

mock_ix_proc.terminate.side_effect = kill_interchange

htex.shutdown()
with caplog.at_level(logging.INFO):
htex.shutdown()

if started:
assert mock_ix_proc.terminate.called
Expand Down

0 comments on commit 2f6a185

Please sign in to comment.