Skip to content

Commit

Permalink
Verify a test pre-condition (#2841)
Browse files Browse the repository at this point in the history
As seen in CI at least once, it's possible that the noop() function takes too
long to complete.  Address by:

- increasing the timeout
- removing the now-deemed-extraneous other parameterizations
- and verifying the test pre-condition first.  ("We expect to get a result!")

Reference problem observed: #2812 (comment)
  • Loading branch information
khk-globus authored Jul 21, 2023
1 parent d5db72f commit 6bb3373
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions parsl/tests/test_python_apps/test_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ def kernel(fail=False):
raise TimeoutTestSpecificException()


@pytest.mark.parametrize("timeout_dur", (0.005, 0.01, 0.1))
def test_timeout(timeout_dur):
timeout(kernel, timeout_dur)()
def test_timeout():
timeout_dur = 0.1
try:
timeout(kernel, timeout_dur)() # nominally returns "instantly"
except AppTimeout:
pytest.skip("Pre-condition failed: result not received in timely fashion")
assert False

try:
time.sleep(timeout_dur + 0.01) # this is the verification
except AppTimeout:
assert False, "Timer was not cancelled!"


@pytest.mark.parametrize("timeout_dur", (0.005, 0.01, 0.1))
@pytest.mark.parametrize("timeout_dur", (0.005, 0.01))
def test_timeout_after_exception(timeout_dur):
with pytest.raises(TimeoutTestSpecificException):
timeout(kernel, timeout_dur)(True)
Expand Down

0 comments on commit 6bb3373

Please sign in to comment.