简体   繁体   中英

py.test -k: collecting tests takes too much time

If I do Run Unittest .... test_foo in PyCharm it takes quite long to run the test, since all tests get collected first. PyCharm uses py.test -k to run the test.

Since we have more than 1000 tests, collecting them takes some time (about 1.2 seconds). Often the test itself needs less time to execute!

Since I use this very often, I want to speed this up.

Any idea how to get this done?

you can overcome the speed problem by calling it with --collectonly or by using the relative path like

py.test src/www/tests/

You can see more solutions on here

Answer to own question:

I installed pyCharm again (for other reasons) and now it uses utrunner.py.

It is much faster if I run Run 'Unittest test_foo' , since not this does not collect all tests before running the test.

Problem solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM