Automatically skip slow tests
You can mark a test as slow using: @pytest.mark.slow def test_something(): ... Use the option "--runslow" to tell the test runner to also include slow tests: py.test --runslow ...remotes/origin/enhancement/email-actions
parent
55f5c70e4e
commit
ac49a76146
|
@ -1,5 +1,3 @@
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,3 +8,12 @@ class Object:
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def object():
|
def object():
|
||||||
return Object()
|
return Object()
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_addoption(parser):
|
||||||
|
parser.addoption("--runslow", action="store_true", help="run slow tests")
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_runtest_setup(item):
|
||||||
|
if "slow" in item.keywords and not item.config.getoption("--runslow"):
|
||||||
|
pytest.skip("need --runslow option to run")
|
||||||
|
|
Loading…
Reference in New Issue