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

Parameterized asynchronous execution test cases #694

Open
yysc622 opened this issue Nov 29, 2023 · 1 comment
Open

Parameterized asynchronous execution test cases #694

yysc622 opened this issue Nov 29, 2023 · 1 comment

Comments

@yysc622
Copy link

yysc622 commented Nov 29, 2023

Can we use pytest.mark.asyncio combined with pytest.mark.parameter to execute multiple test cases asynchronously, in order to shorten the entire execution process?
If possible, could you provide a code example

@seifertm
Copy link
Contributor

It's possible to use pytest.mark.asyncio in conjunction with pytest.mark.parametrize, but the tests will be executed synchronously. Pytest doesn't run tests cases concurrently, neither does pytest-asyncio. Please refer to #69 for a more in-depth discussion.

I think it's a good idea to keep this issue open and use it for adding those two points to the documentation:

  1. An explanation how pytest-asyncio runs tests and that tests don't run concurrently.
  2. An example showing the use of asyncio and parametrize markers for the same test

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

No branches or pull requests

2 participants