tobiko/roles/tobiko-tox/defaults/main.yaml
Eduardo Olivares 5af7c53c05 Add support to skip tests from CLI
With this patch, a new pytest optional arg has been added:
--skipregex

When it is used, tests are skipped when the regex is found in their test
names. Fully qualified test names are used for this search. Example:
tobiko.tests.unit.test_exception.TestException.test_init

It can be used from CLI with pytest like this:
$ .tox/py3/bin/pytest \
  --skipregex='test_join_chunks_.*_bytes|test_join_chunks_with_unicodes' \
  tobiko/tests/unit

It can be used from CLI with tox like this:
$ PYTEST_ADDOPTS="--skipregex='test_join_chunks_.*_bytes|test_join_chunks_with_unicodes'" \
  TOX_PYTHON=python3.9 \
  tox -e py3

It can be used from the Tobiko Infrared plugin by using the following
option (limitation: the skipregex is applied to all the steps from the
the executed Tobiko workflow):
$ infrared tobiko ... --pytest-addopts "--skipregex='test_join_chunks_.*_bytes|test_join_chunks_with_unicodes'"

It can be used from a zuul job by configuring the following variable
within the zuul job yaml file (limitation: the skipregex is applied to
all the steps from the executed Tobiko workflow):
pytest_addopts_global: "--skipregex='test_join_chunks_.*_bytes|test_join_chunks_with_unicodes'"

Change-Id: I8ee32ba467bd70142816953598d1736fa353d3d0
2023-12-04 12:17:26 +01:00

44 lines
1.3 KiB
YAML

---
# Directory where test cases has been deployed to
tox_description: 'run test cases'
tox_dir: '{{ test_dir | realpath }}'
tox_command: '{{ tox_executable | default(tox) }}'
tox_environment: {}
tox_envlist:
tox_extra_args: ''
tox_python: '{{ python_executable }}'
tox_report_dir: '{{ test_report_dir | realpath }}'
tox_step_name:
tox_step_index: 0
tox_report_name:
"{{ test_report_name }}{% if tox_step_index %}_{{ '{:02d}'.format(tox_step_index | int) }}{% endif %}{% if tox_step_name %}_{{ tox_step_name }}{% endif %}{% if tox_envlist %}_{{ tox_envlist }}{% endif %}"
tox_run_tests_timeout: 18000 # 5 hours
tox_constraints: ''
tox_constrain_env:
PYTEST_ADDOPTS: >
{% if pytest_markers %}-m '{{ pytest_markers }}'{% endif %}
{% if pytest_maxfail %}--maxfail '{{ pytest_maxfail }}'{% endif %}
{{ pytest_addopts }}
TOX_REPORT_DIR: '{{ tox_report_dir }}'
TOX_REPORT_NAME: '{{ tox_report_name }}'
TOX_CONSTRAINTS: '{{ tox_constraints }}'
TOX_RUN_TESTS_TIMEOUT: '{{ tox_run_tests_timeout | float }}'
tox_succeeded_rc: 0
tox_failed_rc: 1
tox_expected_rcs:
- '{{ tox_succeeded_rc }}'
ignore_test_failures: no
pytest_addopts: '{{ pytest_addopts_global }}'
pytest_addopts_global: ''
pytest_markers: "{% if not test_flaky%}not flaky{% endif %}"
pytest_maxfail: ''
test_flaky: false