Merge pull request #1096 from hackebrot/update-docs-skip-with-cli-option
Update docs skip with cli option
This commit is contained in:
commit
9263b3a051
|
@ -131,20 +131,23 @@ line option to control skipping of ``slow`` marked tests::
|
||||||
parser.addoption("--runslow", action="store_true",
|
parser.addoption("--runslow", action="store_true",
|
||||||
help="run slow tests")
|
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")
|
|
||||||
|
|
||||||
We can now write a test module like this::
|
We can now write a test module like this::
|
||||||
|
|
||||||
# content of test_module.py
|
# content of test_module.py
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
slow = pytest.mark.slow
|
|
||||||
|
|
||||||
|
slow = pytest.mark.skipif(
|
||||||
|
not pytest.config.getoption("--runslow"),
|
||||||
|
reason="need --runslow option to run"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_func_fast():
|
def test_func_fast():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@slow
|
@slow
|
||||||
def test_func_slow():
|
def test_func_slow():
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue