Skip to content
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

Concurrent async fixture setup / teardown #118

Open
dimaqq opened this issue Mar 28, 2019 · 2 comments
Open

Concurrent async fixture setup / teardown #118

dimaqq opened this issue Mar 28, 2019 · 2 comments

Comments

@dimaqq
Copy link

dimaqq commented Mar 28, 2019

This is more an idea / question how hard it would be.

While pytest ensures stable fixture order, it's made with synchronous fixtures in mind.

pytest-asyncio on the other hand allows for async fixtures and typically async test cases imply async code under test which implies async dependencies which imply async fixtures.

Thus, how about running setup and teardown asynchronously too, for example:

@pytest.fixture
async def A():
    ...
    yield
    ...

@pytest.fixture
async def B(A):
    ...
    yield
    ...

@pytest.fixture
async def C(A):
    ...
    yield
    ...

@pytest.fixture
async def D(B, C):
    ...
    yield
    ...

Would run as:

  • A setup
  • asyncio.gather(B setup, C setup)
  • D setup
  • test case
  • D teardown
  • asyncio.gather(B teardown, C teardown)
  • A teardown
@seifertm
Copy link
Contributor

@dimaqq I know this issue is specifically about the fixture setup. #69 is about running tests asynchronously.

Would it be acceptable for you to close this issue in favour of #69?

@dimaqq
Copy link
Author

dimaqq commented Mar 26, 2022

I think you can decide that @seifertm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants