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.
diff --git a/setup.cfg b/setup.cfg
index 8f095fa..83c381b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -18,6 +18,7 @@
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 e69de29..1b8ab40 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 8d33fa0..1d36373 100755
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -70,8 +70,11 @@
# 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")
#################################################