Skip to content

Passing a custom clock to the executor in tests #1047

@fjarri

Description

@fjarri

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

pytest-trio has a very useful feature of supporting custom clocks that are passed to trio.run() when running a test (see https://pytest-trio.readthedocs.io/en/stable/reference.html#mock_clock, basically it looks through fixtures to see if something derives from trio.abc.Clock). I couldn't find a way to do this for anyio tests. Is it something that's impossible by design, or just hasn't been implemented yet?

Use case

Reducing test runtime for code that relies on some internal waiting times, e.g. running recurrent tasks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions