Skip to content

Commit

Permalink
Rename 'nursery' fixture to 'test_nursery'
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
njsmith committed Jul 25, 2018
1 parent 29be010 commit 2a3a024
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pytest_trio/_tests/test_nursery_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ async def handle_client(stream):


@pytest.fixture
async def server(nursery):
listeners = await nursery.start(trio.serve_tcp, handle_client, 0)
async def server(test_nursery):
listeners = await test_nursery.start(trio.serve_tcp, handle_client, 0)
return listeners[0]


Expand Down
13 changes: 12 additions & 1 deletion pytest_trio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,16 @@ def autojump_clock():


@trio_fixture
def nursery(request):
def test_nursery(request):
return request.node._trio_nursery


@trio_fixture
def nursery(test_nursery):
import warnings
warnings.warn(
FutureWarning(
"The 'nursery' fixture has been renamed to 'test_nursery'"
)
)
return test_nursery

0 comments on commit 2a3a024

Please sign in to comment.