pytest icon indicating copy to clipboard operation
pytest copied to clipboard

avoid tests collection before a test execution

Open rahul0209 opened this issue 2 years ago • 4 comments

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.

rahul0209 avatar Nov 30 '23 05:11 rahul0209

The recommended way is to Pass specific filenames or test ids

RonnyPfannschmidt avatar Nov 30 '23 06:11 RonnyPfannschmidt

python -m pytest -s -v filename.py::className::testsname even then also it takes that much time for collection

rahul0209 avatar Nov 30 '23 06:11 rahul0209

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

RonnyPfannschmidt avatar Nov 30 '23 07:11 RonnyPfannschmidt

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Dec 31 '23 01:12 github-actions[bot]

Stale for a long time and no-follow up, just helping the bot here a bit and closing manually.

obestwalter avatar Jun 17 '24 13:06 obestwalter