diff --git a/infrared_plugin/plugin.spec b/infrared_plugin/plugin.spec index 7fcf58c59..cb7bc2a6c 100644 --- a/infrared_plugin/plugin.spec +++ b/infrared_plugin/plugin.spec @@ -191,6 +191,12 @@ subparsers: type: Value help: Extra options to be passed to PyTest ansible_variable: pytest_addopts + pytest-markers: + type: Value + help: > + only run tests matching given mark expression. + For example: --pytest-markers 'mark1 and not mark2'. + ansible_variable: pytest_markers pytest-maxfail: type: Value help: Max number of test case failures before aborting diff --git a/roles/tobiko-tox/defaults/main.yaml b/roles/tobiko-tox/defaults/main.yaml index a77ec9b57..b04a5d427 100644 --- a/roles/tobiko-tox/defaults/main.yaml +++ b/roles/tobiko-tox/defaults/main.yaml @@ -21,7 +21,7 @@ tox_constraints: '' tox_constrain_env: PYTEST_ADDOPTS: > - {% if not test_flaky%}-m 'not flaky'{% endif %} + {% if pytest_markers %}-m '{{ pytest_markers }}'{% endif %} {% if pytest_maxfail %}--maxfail '{{ pytest_maxfail }}'{% endif %} {{ pytest_addopts }} TOX_REPORT_DIR: '{{ tox_report_dir }}' @@ -37,5 +37,6 @@ tox_expected_rcs: ignore_test_failures: no pytest_addopts: '' +pytest_markers: "{% if not test_flaky%}not flaky{% endif %}" pytest_maxfail: '' test_flaky: false