python-trio / python-trio/trio

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

Open
#152 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pytest-trio relevant todo soon
Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading conftest.py and the existing assert_yields usage, then verify how sys.set_coroutine_wrapper and the proposed enforce_checkpoint wrapper interact with the test suite. Done means the suite enforces assert_yields for all relevant coroutines without breaking existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.