-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework fixtures #50
Rework fixtures #50
Commits on Jul 25, 2018
-
- Add @pytest_trio.trio_fixture for explicitly marking a fixture as being a trio fixture - Make the nursery fixture a @trio_fixture - Refactor Trio fixture classes into one class - Check for trio marker instead of trio keyword (fixes python-triogh-43) - This also raises the minimum pytest version to 3.6 - Raise an error if a Trio fixture is used with a non-function scope (fixes python-triogh-18) - Raise an error if a Trio fixture is used with a non-Trio test I think this also closes python-triogh-10's discussion, though we still need to convince pytest-asyncio to fix their side of things.
Configuration menu - View commit details
-
Copy full SHA for 2036d76 - Browse repository at this point
Copy the full SHA 2036d76View commit details -
Rename 'nursery' fixture to 'test_nursery'
Every nursery is called 'nursery'. This is less generic, and emphasizes that this nursery is special, because its lifetime is linked to the test. Kept 'nursery' around for now as a deprecated alias.
Configuration menu - View commit details
-
Copy full SHA for 82afdab - Browse repository at this point
Copy the full SHA 82afdabView commit details -
Configuration menu - View commit details
-
Copy full SHA for 87fd141 - Browse repository at this point
Copy the full SHA 87fd141View commit details -
In Trio mode, auto-convert async fixtures to Trio fixtures
The main benefit of this is that it lets us catch more cases where these fixtures are accidentally misused. Closes python-triogh-18 Closes python-triogh-51
Configuration menu - View commit details
-
Copy full SHA for eb42b8a - Browse repository at this point
Copy the full SHA eb42b8aView commit details
Commits on Aug 15, 2018
-
Totally redo fixture/test setup/teardown, yet again
See python-trio#55 for discussion. Main points: * Fixture setup/teardown is now performed concurrently whenever possible. * Each fixture is now run in an isolated task, and it's now safe to use nurseries inside fixtures (fixes python-triogh-55). * New magical fixture 'fixture_nursery' which gives a nursery that's cancelled immediately after *the requesting fixture finishes teardown*. If requested directly by the test itself, gives a nursery which is cancelled after the test finishes, before other fixtures are torn down.
Configuration menu - View commit details
-
Copy full SHA for fe65b49 - Browse repository at this point
Copy the full SHA fe65b49View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4a477a5 - Browse repository at this point
Copy the full SHA 4a477a5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f8a019 - Browse repository at this point
Copy the full SHA 4f8a019View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4e31ce9 - Browse repository at this point
Copy the full SHA 4e31ce9View commit details -
Revert back to 'nursery' as the name of the magic nursery fixture
At this point this: @pytest.fixture async fix(nursery): ... is just a shorthand for this (they should be exactly equivalent): @pytest.fixture async fix(): async with trio.open_nursery() as nursery: try: ... finally: nursery.cancel_scope.cancel() And the latter is the obvious thing you would write by hand, there's really no other way to do it. And since it no longer has special subtle semantics, I'm no longer bothered by using the short name 'nursery'. Plus the longer I looked at 'fixture_nursery' the more annoying the name seemed. Plus I made that last minute change so you can use the magic nursery inside tests too, not just fixtures, so the name didn't even make much sense.
Configuration menu - View commit details
-
Copy full SHA for 25e9e19 - Browse repository at this point
Copy the full SHA 25e9e19View commit details
Commits on Aug 17, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 0154411 - Browse repository at this point
Copy the full SHA 0154411View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9138b86 - Browse repository at this point
Copy the full SHA 9138b86View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4d2ec80 - Browse repository at this point
Copy the full SHA 4d2ec80View commit details
Commits on Aug 22, 2018
-
Share contextvars across fixtures
This is sort of a gross hack, but it's simple and works. If it causes problems, then this comment discusses some other options: python-trio#50 (comment) Also added tests for using trio-asyncio in fixtures (which was the motivating use case for sharing contextvars).
Configuration menu - View commit details
-
Copy full SHA for ef0cd26 - Browse repository at this point
Copy the full SHA ef0cd26View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2e5f6f7 - Browse repository at this point
Copy the full SHA 2e5f6f7View commit details -
Skip trio-asyncio tests on py35
When importing trio-asyncio v0.8.0 on py35, we get a crash at import time: .../python3.5/site-packages/trio_asyncio/loop.py:171: in <module> _orig_run_get = _aio_event._get_running_loop E AttributeError: module 'asyncio.events' has no attribute '_get_running_loop' See: https://travis-ci.org/python-trio/pytest-trio/jobs/419092404 So let's skip testing this for now...
Configuration menu - View commit details
-
Copy full SHA for b0559c1 - Browse repository at this point
Copy the full SHA b0559c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 98ba48b - Browse repository at this point
Copy the full SHA 98ba48bView commit details