Module: check_mk
Branch: master
Commit: c11fa0ba36a3f4bd9d87a132a13e489dcc18cd07
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c11fa0ba36a3f4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 7 16:04:35 2018 +0100
Fix test selection after py.test 3.10.0 update
Change-Id: Ic171d403848da11fa0e9ffc612dcf94e03f4fbc4
---
conftest.py | 20 ++++++++++++++++++++
tests/conftest.py | 14 --------------
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/conftest.py b/conftest.py
new file mode 100644
index 0000000..7c69987
--- /dev/null
+++ b/conftest.py
@@ -0,0 +1,20 @@
+import pytest
+
+# Our enterprise tests are located at enterprise/tests. During tests our enterprise tests
are
+# found by py.tests because of symlinks at tests/{integration,unit}/enterprise.
+# Since
https://github.com/pytest-dev/pytest/issues/4174 the conftest.py in
tests/conftest.py
+# does not apply anymore on the tests that are physically located in enterprise/tests.
+# Our workaround to make the skipping work again was to move this function to the top
level
+# conftest.py file.
+def pytest_runtest_setup(item):
+ """Skip tests of unwanted types"""
+ test_type = item.get_closest_marker("type")
+ if test_type is None:
+ raise Exception("Test is not TYPE marked: %s" % item)
+
+ if not item.config.getoption("-T"):
+ raise SystemExit("Please specify type of tests to be executed (py.test -T
TYPE)")
+
+ test_type_name = test_type.args[0]
+ if test_type_name != item.config.getoption("-T"):
+ pytest.skip("Not testing type %r" % test_type_name)
diff --git a/tests/conftest.py b/tests/conftest.py
index d24a751..09db7f7 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -80,20 +80,6 @@ def pytest_collection_modifyitems(items):
item.add_marker(pytest.mark.type.with_args(ty))
-def pytest_runtest_setup(item):
- """Skip tests of unwanted types"""
- test_type = item.get_closest_marker("type")
- if test_type is None:
- raise Exception("Test is not TYPE marked: %s" % item)
-
- if not item.config.getoption("-T"):
- raise SystemExit("Please specify type of tests to be executed (py.test -T
TYPE)")
-
- test_type_name = test_type.args[0]
- if test_type_name != item.config.getoption("-T"):
- pytest.skip("Not testing type %r" % test_type_name)
-
-
# Some cmk.* code is calling things like cmk. is_raw_edition() at import time
# (e.g. cmk_base/default_config/notify.py) for edition specific variable
# defaults. In integration tests we want to use the exact version of the