Skip to content

add pytest-timeout #4445

Closed
Closed

Description

@ajpotts

Add pytest-timeout to the unit tests, to optionally put a timeout on certain tests.

Activity

  1. self-assigned this
    on May 22, 2025
  2. ajpotts commented on May 22, 2025

    @ajpotts
    ContributorAuthor

    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."

  3. removed their assignment
    on May 22, 2025
  4. lydia-duncan commented on Jun 18, 2025

    @lydia-duncan
    Contributor

    That's disappointing, thanks for investigating it!

  5. bradcray commented on Jun 18, 2025

    @bradcray
    Contributor

    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.

  6. added 3 commits that reference this issue on Jun 23, 2025
    19c28f3
    56c8a3a
    5f1a5cc
  7. added a commit that references this issue on Jun 24, 2025
    84bc609
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions