I usually run my tests with tox
which calls pytest
. This setup works fine in many projects. In some projects, however, I have some tests which take long (several minutes). I don't want to run them every time. I would like to decorate the tests as long.
Something like this:
$ tox --skip-long
and
# core modules
import unittest
class Foo(unittest.TestCase):
def test_bar(self):
...
@long
def test_long_bar(self):
...
How can I do this?
I found half of the answer here:
@pytest.mark.long
and execute
pytest -v -m "not long"
To run it on tox (source):
tox -- -m "not long"
The output then looks like this:
============================ 2 tests deselected ==================================
========== 20 passed, 2 deselected, 7 warnings in 151.93 seconds =================