Is there a way to assert that a Pytest test case has failed due to a pytest timeout? I want to run a longevity test that I expect to run without issue, until a pytest timeout is encountered. I annotate the test with @pytest.mark.timeout(6000)to override the default pytest timeout, and when the 6000 second timeout is encountered, the test fails with E Failed: Timeout >6000.0s
.
I've tried adding with pytest.raises(pytest.TimeoutExpired)
to my test to catch the eventual timeout, but that doesn't seem to do the trick. Is there a way to properly catch the timeout raised by pytest?