Skip to content
Snippets Groups Projects
Commit f77caa25 authored by Timothy A. Smith's avatar Timothy A. Smith
Browse files

tests marked with @pytest.mark.slow will be skipped by default, but not by the CI script

parent 112064d1
No related branches found
No related tags found
2 merge requests!9Mark slow tests,!8Test refactoring
Pipeline #17910 passed
......@@ -85,6 +85,6 @@ if test -f $REQUIREMENTS_TXT; then
$PIP install -r $REQUIREMENTS_TXT
fi
${PY_EXE} -m pytest -rw --durations=10 --tb=native --junitxml=pytest.xml -rxsw test.py
${PY_EXE} -m pytest -rw --durations=10 --tb=native --junitxml=pytest.xml -rxsw --runslow test.py
# vim: foldmethod=marker
# setup to mark slow tests with @pytest.mark.slow, so that they don't run by
# default, but can be forced to run with the command-line option --runslow
# taken from
# https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true", default=False,
help="run slow tests")
def pytest_collection_modifyitems(config, items):
if config.getoption("--runslow"):
# --runslow given in cli: do not skip slow tests
return
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment