summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbschubert15 <bschubert15@bloomberg.net>2020-04-17 09:42:04 +0100
committerbschubert15 <bschubert15@bloomberg.net>2020-04-17 09:42:04 +0100
commit4ceeb50fe14383ed0d0dd433cfd05d78b618095f (patch)
treeb05bd5e8152ea39852ccf6a020a73886ac388e3c
parent431cd16a997a4f548d2f262031f8eefc947158e7 (diff)
downloadbuildstream-4ceeb50fe14383ed0d0dd433cfd05d78b618095f.tar.gz
conftest.py: Allow running tests using external plugins with --plugins
This introduces a `pytest.mark.plugins` marker that signifies that a test requires external plugins to run, and will only run them if specifying `--plugins` on the pytest invocation.
-rw-r--r--setup.cfg1
-rw-r--r--src/buildstream/testing/_sourcetests/__init__.py4
-rwxr-xr-xtests/conftest.py7
3 files changed, 10 insertions, 2 deletions
diff --git a/setup.cfg b/setup.cfg
index 8b3d60388..1f4638f5b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -18,6 +18,7 @@ markers =
datafiles: data files for tests
integration: run test only if --integration option is specified
remoteexecution: run test only if --remote-execution option is specified
+ plugins: run test only if --plugins option is specified
xfail_strict=True
[mypy]
diff --git a/src/buildstream/testing/_sourcetests/__init__.py b/src/buildstream/testing/_sourcetests/__init__.py
index e69de29bb..1b8ab40e1 100644
--- a/src/buildstream/testing/_sourcetests/__init__.py
+++ b/src/buildstream/testing/_sourcetests/__init__.py
@@ -0,0 +1,4 @@
+import pytest
+
+# All source tests are plugin tests
+pytestmark = pytest.mark.plugins
diff --git a/tests/conftest.py b/tests/conftest.py
index 8d33fa024..1d3637320 100755
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -70,8 +70,11 @@ def pytest_runtest_setup(item):
# With --plugins only run plugins tests
if item.config.getvalue("plugins"):
- if not item.get_closest_marker("generic_source_test"):
- pytest.skip("Skipping not generic source test")
+ if not item.get_closest_marker("plugins"):
+ pytest.skip("Skipping tests that are not marked as requiring external plugins")
+ else:
+ if item.get_closest_marker("plugins"):
+ pytest.skip("Skipping tests that are marked as requiring external plugins")
#################################################