From 2d2bd16a1f931b4aece069baf94257df22e869cc Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Fri, 6 Dec 2019 09:58:07 +0000 Subject: tox.ini: Add a external plugins environment test and run it in CI This runs two versions of the plugins: - The latest stable is not allowed failures and is run on every platform - The master version is allowed failure, and only runs on a single architecture This also adds a new entrypoint to register source tests to run against BuildStream. --- tests/conftest.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/conftest.py b/tests/conftest.py index cfca4ad06..8d33fa024 100755 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,6 +21,8 @@ # import os import multiprocessing + +import pkg_resources import pytest from buildstream.testing import register_repo_kind, sourcetests_collection_hook @@ -46,7 +48,7 @@ from tests.testutils.repo.zip import Zip ################################################# def pytest_addoption(parser): parser.addoption("--integration", action="store_true", default=False, help="Run integration tests") - + parser.addoption("--plugins", action="store_true", default=False, help="Run only plugins tests") parser.addoption("--remote-execution", action="store_true", default=False, help="Run remote-execution tests only") @@ -66,6 +68,11 @@ def pytest_runtest_setup(item): if item.get_closest_marker("remoteexecution"): pytest.skip("skipping remote-execution test") + # 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") + ################################################# # remote_services fixture # @@ -112,6 +119,12 @@ register_repo_kind("zip", Zip, None) # This hook enables pytest to collect the templated source tests from # buildstream.testing def pytest_sessionstart(session): + if session.config.getvalue("plugins"): + # Enable all plugins that implement the 'buildstream.tests.source_plugins' hook + for entrypoint in pkg_resources.iter_entry_points("buildstream.tests.source_plugins"): + module = entrypoint.load() + module.register_sources() + sourcetests_collection_hook(session) -- cgit v1.2.1