Skip to content

Commit b3683d4

Browse files
ricardoV94twiecki
authored andcommittedNov 25, 2022
Add pytest slow mark
1 parent 8ac1833 commit b3683d4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 

‎conftest.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import pytest
2+
3+
4+
def pytest_addoption(parser):
5+
parser.addoption("--runslow", action="store_true", default=False, help="run slow tests")
6+
7+
8+
def pytest_configure(config):
9+
config.addinivalue_line("markers", "slow: mark test as slow to run")
10+
11+
12+
def pytest_collection_modifyitems(config, items):
13+
if config.getoption("--runslow"):
14+
# --runslow given in cli: do not skip slow tests
15+
return
16+
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
17+
for item in items:
18+
if "slow" in item.keywords:
19+
item.add_marker(skip_slow)

0 commit comments

Comments
 (0)
Please sign in to comment.