Skip to content

Commit f1a5523

Browse files
committed
@pytest.mark.slow and --runslow option
1 parent 6769bd8 commit f1a5523

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

torch_np/tests/conftest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
3+
4+
def pytest_configure(config):
5+
config.addinivalue_line("markers", "slow: very slow tests")
6+
7+
8+
def pytest_addoption(parser):
9+
parser.addoption("--runslow", action="store_true", help="run slow tests")
10+
11+
12+
def pytest_collection_modifyitems(config, items):
13+
if not config.getoption("--runslow"):
14+
skip_slow = pytest.mark.skip(reason="slow test, use --runslow to run")
15+
for item in items:
16+
if "slow" in item.keywords:
17+
item.add_marker(skip_slow)

0 commit comments

Comments
 (0)