-
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
Test collection consumes too many resources in large workspaces #4221
Comments
Hi @koliyo, thanks for the bug report. I've attempted to reproduce your issue using the Question: What version of pytest are you using? Also, could you try the following and let me know if it works for you? Run from the command shell:
Run against a simplified workspace:
def test_pytest_discovery():
assert 1 + 1 == 2
|
Some new information. This is for a big C++ project were we have SWIG python bindings and python scripts. The problem was pytest is recursing down all directories, which in my case includes a bunch of build directories inside this project root. I have
I have now added a
I also looked at the norecursedirs configuration option. Now I no longer see this problem. But it makes it a little discouraging to enable pytest globally in my VS Code config. Seems better to enable it only for specific projects, which is what I am going to do. |
Ah I see, the problem is that our test discovery solution is burning through cycles in a relatively large project. Problem StatementOn a very large project with many folders in the workspace, Python unit test discovery can take a lot of resources to complete. Detect when test discovery is taking too long and/or visiting too many folders and propose a solution to the user via some mechanism such as a popup. WorkaroundMake use of pytest.ini: [pytest]
testPaths = relative/path/to/tests/root or the something like Changing the name of this issue and proposing it as an enhancement to the team. |
Closing as nothing needs to be done here. |
I solved this by adding a This is why
I had not configured pytest at all. We are not even using pytest in this project, this is why I still think this is an issue If the conclusion is that this is a user problem, then I think there should be a BIG warning in the global VS code setting for |
This is something the user chose to enable , see below
Again, user enabled this, and it is pytest consuming the resources as it had been enabled for this workspace implicitly. We can reopen this issue depending on the number of upvotes to this issue. I.e. if others come across similar issues, we will address it, |
Environment data
Expected behaviour
Not taking over all my CPUs
Actual behaviour
Large amounts of pytest processes running, grabbing all my CPU cores.
NOTE: Not running actual tests, only gathering test info with
--collect-only
flagSteps to reproduce:
Not sure at this point
I do have pytest functionality enabled
Logs
The text was updated successfully, but these errors were encountered: