Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify a test pre-condition #2841

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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