forked from celery/kombu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
17 lines (14 loc) · 693 Bytes
/
conftest.py
File metadata and controls
17 lines (14 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import pytest
def pytest_addoption(parser):
parser.addoption("-E", action="append", metavar="NAME",
help="only run tests matching the environment NAME.")
def pytest_configure(config):
# register an additional marker
config.addinivalue_line("markers",
"env(name): mark test to run only on named environment")
def pytest_runtest_setup(item):
envnames = [mark.args[0] for mark in item.iter_markers(name='env')]
if envnames:
if item.config.getoption("-E") is None or len(set(item.config.getoption("-E")) & set(envnames)) == 0:
# We skip test if does not mentioned by -E param
pytest.skip("test requires env in %r" % envnames)