forked from araffin/robotics-rl-srl
-
Notifications
You must be signed in to change notification settings - Fork 4
/
conftest.py
23 lines (19 loc) · 977 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pytest
def pytest_addoption(parser):
parser.addoption("--fast", action="store_true", default=False,
help="only run RL with ground truth, and quickly test all the envs")
parser.addoption("--all", action="store_true", default=False,
help="run all the tests")
def pytest_collection_modifyitems(config, items):
if config.getoption("--fast") and config.getoption("--all"):
raise AssertionError("Error: incompatible test flags requested")
elif config.getoption("--fast"):
skip_not_fast = pytest.mark.skip(reason="need to remove --fast option to run")
for item in items:
if "fast" not in item.keywords:
item.add_marker(skip_not_fast)
elif not config.getoption("--all"):
skip_slow = pytest.mark.skip(reason="need to add --all option to run")
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)