Is there some way to speed up the repeated execution of pytest? It seems to spend a lot of time collecting tests, even if I specify which files to execute on the command line. I know it isn't a disk speed issue either since running pyflakes across all the .py files is very fast.
The various answers represent different ways pytest can be slow. They helped sometimes, did not in others. I'm adding one more answer that explains a common speed problem. But it's not possible to select "The" answer here.
--collectonly. - alecxe--collectonly. Post collection the execution is almost immediate. - edA-qa mort-ora-yparametrizes, fixtures, andpytest_generate_testswhich make collecting slower, despite this collecting is fast in my case. Check that you do not have own code which interact with pytest collection phase and make it slower. If not, you can run profiler like line profiler to see which code is slow. - spinuspy.testin Cygwin.py.test --collectonlyseems stuck for several seconds even before it actually starts collecting. - famousgarkin