summaryrefslogtreecommitdiff
path: root/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'conftest.py')
-rw-r--r--conftest.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/conftest.py b/conftest.py
new file mode 100644
index 0000000..e48a5f0
--- /dev/null
+++ b/conftest.py
@@ -0,0 +1,15 @@
+import pytest
+def pytest_addoption(parser):
+ parser.addoption("-E", action="store", 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") not in envnames:
+ pytest.skip("test requires env in %r" % envnames)