You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I looked into adding pytest-timeout. It can be used to cancel a test by adding a marker like @pytest.mark.timeout(2) above the test. However, when I added to the first test in the module, and the test timed out, it caused the following tests to fail as well with errors like: zmq.error.ZMQError: Operation cannot be accomplished in current state
According to ChatGPT: "You're running into a classic issue: when a test using pytest-timeout kills the process or thread mid-operation, it can leave global or shared state in a corrupted or unusable condition — especially when using stateful clients like zmq."
That behavior might still be an improvement though? Consider: Today if we have a test spin infinitely, it can soak up hours and hours of machine time with nothing useful being done and no output for any tests that follow it. However, if pytest-timeout were to kill it after 5 minutes (say), even though we still wouldn't get any subsequent data, we also wouldn't waste all that machine time, which I think of as being the main point of #4441.
It also may be that with more work, we could have a timed out test do something like kill/restart the server, which might permit the subsequent tests to run. But even doing the simple thing seems like a potential step forward to me.
Activity
ajpotts commentedon May 22, 2025
I looked into adding
pytest-timeout. It can be used to cancel a test by adding a marker like@pytest.mark.timeout(2)above the test. However, when I added to the first test in the module, and the test timed out, it caused the following tests to fail as well with errors like:zmq.error.ZMQError: Operation cannot be accomplished in current stateAccording to ChatGPT: "You're running into a classic issue: when a test using pytest-timeout kills the process or thread mid-operation, it can leave global or shared state in a corrupted or unusable condition — especially when using stateful clients like zmq."
lydia-duncan commentedon Jun 18, 2025
That's disappointing, thanks for investigating it!
bradcray commentedon Jun 18, 2025
That behavior might still be an improvement though? Consider: Today if we have a test spin infinitely, it can soak up hours and hours of machine time with nothing useful being done and no output for any tests that follow it. However, if pytest-timeout were to kill it after 5 minutes (say), even though we still wouldn't get any subsequent data, we also wouldn't waste all that machine time, which I think of as being the main point of #4441.
It also may be that with more work, we could have a timed out test do something like kill/restart the server, which might permit the subsequent tests to run. But even doing the simple thing seems like a potential step forward to me.
Closes Bears-R-Us#4445: add pytest-timeout
Closes Bears-R-Us#4445: add pytest-timeout
Closes Bears-R-Us#4445: add pytest-timeout
Closes Bears-R-Us#4445: add pytest-timeout (Bears-R-Us#4654)