Skip to content

Commit 1ca7255

Browse files
authored
Merge pull request #71 from honno/slow-marker
`@pytest.mark.slow` and `--runslow` option
2 parents 6769bd8 + e17ca58 commit 1ca7255

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.github/workflows/basic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ jobs:
4646
ls -l
4747
- name: Run tests
4848
run: |
49-
pytest torch_np/ -v -s -n 2
49+
pytest torch_np/ -v -s -n 2 --runslow
5050

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)