diff options
author | Martin Blanchard <martin.blanchard@codethink.co.uk> | 2019-03-21 15:23:20 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-03-25 12:42:57 +0000 |
commit | 21b1dea923d01e3d2d4179e2189595aa9ae678e8 (patch) | |
tree | 7133b68a83debfd296b954d196c2076bb2cbc6d9 /tests/conftest.py | |
parent | 753a14ccc5832b5b97cd54370d6361cad6e62f7a (diff) | |
download | buildstream-21b1dea923d01e3d2d4179e2189595aa9ae678e8.tar.gz |
tests: Add a --remote-execution CLI options
Unlike the --integration option that activates additional tests marked
with 'integration', this new --remote-execution option deactivates all the
tests except those marked with 'remoteexecution'.
https://gitlab.com/BuildStream/buildstream/issues/629
Diffstat (limited to 'tests/conftest.py')
-rwxr-xr-x | tests/conftest.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 7f8da3633..32af72df9 100755 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -38,10 +38,25 @@ def pytest_addoption(parser): parser.addoption('--integration', action='store_true', default=False, help='Run integration tests') + parser.addoption('--remote-execution', action='store_true', default=False, + help='Run remote-execution tests only') + def pytest_runtest_setup(item): - if item.get_closest_marker('integration') and not item.config.getvalue('integration'): - pytest.skip('skipping integration test') + # Without --integration: skip tests not marked with 'integration' + if not item.config.getvalue('integration'): + if item.get_closest_marker('integration'): + pytest.skip('skipping integration test') + + # With --remote-execution: only run tests marked with 'remoteexecution' + if item.config.getvalue('remote_execution'): + if not item.get_closest_marker('remoteexecution'): + pytest.skip('skipping non remote-execution test') + + # Without --remote-execution: skip tests marked with 'remoteexecution' + else: + if item.get_closest_marker('remoteexecution'): + pytest.skip('skipping remote-execution test') ################################################# |