pytest
pytest copied to clipboard
avoid tests collection before a test execution
Tests collection in pytest is time consuming if there are more tests like 50k and more. So if we want run a single tests it 99% time is consumed in collection and remaining 1% in execution. Can we avoid test collection during execution or can we provide a list of tests to be executed so that it knows about tests and then we need to collect all tests at once.
The recommended way is to Pass specific filenames or test ids
python -m pytest -s -v filename.py::className::testsname even then also it takes that much time for collection
Then More input is needed For example excessive pytest plugins or massive dependencies can be a reason
What's the results of Timing collection vs timing key imports
This issue is stale because it has been open for 14 days with no activity.
Stale for a long time and no-follow up, just helping the bot here a bit and closing manually.