-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributortopic: collectionrelated to the collection phaserelated to the collection phase
Milestone
Description
If a collection error occurs, is there a way to terminate immediately pytest execution after collection, avoiding the execution of all the tests (even the ones properly collected)?
Basically I need to start test execution only if there are no import errors.
So for instance, now if there is a collection error I get:
$ pytest test/test_01/test_01.py test/test_02/test_02.py test/test_03/test_03.py -v -s
============================ test session starts =============================
platform linux2 -- Python 2.6.6 -- py-1.4.26 -- pytest-2.7.0.dev1 -- /usr/bin/python
collected 2 items / 1 errors
test/test_01/test_01.py::TestBug::test_n_01 PASSED
test/test_02/test_02.py::TestBug::test_n_02 PASSED
=================================== ERRORS ===================================
________________ ERROR collecting test/test_03/test_03.py _________________
import file mismatch:
a description of the import error
================ 2 passed, 1 error in 0.17 seconds ================
I would get something like this instead:
$ pytest test/test_01/test_01.py test/test_02/test_02.py test/test_03/test_03.py -v -s
============================ test session starts =============================
platform linux2 -- Python 2.6.6 -- py-1.4.26 -- pytest-2.7.0.dev1 -- /usr/bin/python
collected 2 items / 1 errors
=================================== ERRORS =============================
________________ ERROR collecting test/test_03/test_03.py _______________________
import file mismatch:
a description of the import error
================================ 1 error in 0.17 seconds ======================
Is there an options that allows that?
Or maybe this can be done with a plugin?
Thanks
Metadata
Metadata
Assignees
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributortopic: collectionrelated to the collection phaserelated to the collection phase