Skip to content

idea: use sys.set_coroutine_wrapper in the test suite to enforce assert_yields *everywhere* #152

Open

Description

@njsmith

Like:

@types.coroutine
def enforce_checkpoint(coro):
    with assert_yields():
        yield from coro.__await__()
sys.set_coroutine_wrapper(enforce_checkpoint)

and calling this from conftest.py

Activity

  1. njsmith commented on May 14, 2017

    @njsmith
    MemberAuthor

    There are some async functions in trio (esp. in the test suite) that intentionally don't have any checkpoints. The way to handle this I think is to annotate those with @no_checkpoint or something (which just sets a flag that the enforce_checkpoint function would look for), and this would actually be a good piece of executable documentation, as well as being essentially free at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions