-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
pytest.mark.parametrize should not trigger multiple pytest instances #17340
Comments
Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can. |
The same issue, if parameters too much it may hang for a while (as in #17396) |
When you click the gutter to run, VS Code creates a run request with each parametrized test added as a separate item. This causes pytest to be triggered separately for each node, currently we don't reduce the number of nodes we run. See the (384) nodes in the include list when run from the gutter. You can run the parent node for the parametrized tests from the test explorer and it should run only one instance, as a work around for now. See that there is only one node in the include list: We can address this issue to reduce the number of things we run when implementing #16929 . Essentially if all the child nodes for a test are in the include list, then we should just run the parent of those nodes. This issue is not related to #17396, which is fixed in the insiders version of VS Code. #17396 occurred when VC code was attempting to update the UI for large number of tests, after the python extension provided the results from running the tests. |
I've got it. Thank you. Do you have ETA for #16929 ? I have to stick to "v2021.8.1159798656" of the extension because we have a huge amount of parameterized tests in our repo. |
We are working on replacing the test adapter for |
This was causing me grief today. Not only does it trigger multiple pytest instances, it invokes |
Also encountered this today, it's running multiple "sessions" in parallel, causing multiple session-scoped fixtures to run. My session fixtures are not able to run in parallel. Please provide a way to disable this behaviour. |
closing in preference of this new issue which I have engaged on recently: #21529. Please comment on that issue as we are trying to determine desired behavior. I have responded to both the concern regarding tests running in parallel and the individual run requests per parameterized tests. Thank you!! |
Environment data
python.languageServer
setting: pylanceExpected behaviour
Using the test runner, running test with parametrize mark should only use one pytest instance.
Actual behaviour
Test runner runs each param group in a separate pytest instance. In our specific case, since there is database fixture setup in the test, multiple pytest instances will call same queries at the same time, causing conflicts.
Steps to reproduce:
Logs
Output for
Python Test Log
: Note there are two sessions started in the log, each run one parameter groupThe text was updated successfully, but these errors were encountered: