Handle maxfail pytest option from InfraRed plugin
This allows to specify PyTest options depending on the workflow step For instance in the faults workflow step below option is used: --maxfail 1 The option can be forced for all speps with below InfraRed plugin option: --pytest-maxfail <N> For more details about pytest options please have a look to pytest help page: tox -e py3 -- --help Change-Id: I3146819b5f80fa4768ea38032cc8e69dc7b44f18
This commit is contained in:
@@ -20,8 +20,10 @@ tox_run_tests_timeout: 18000 # 5 hours
|
||||
tox_constraints: ''
|
||||
|
||||
tox_constrain_env:
|
||||
PYTEST_ADDOPTS:
|
||||
"{% if not test_flaky %}-m 'not flaky' {% endif %}{{ pytest_addopts }}"
|
||||
PYTEST_ADDOPTS: >
|
||||
{% if not test_flaky%}-m 'not flaky'{% 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 }}'
|
||||
@@ -35,4 +37,5 @@ tox_expected_rcs:
|
||||
ignore_test_failures: no
|
||||
|
||||
pytest_addopts: ''
|
||||
pytest_maxfail: ''
|
||||
test_flaky: false
|
||||
|
||||
@@ -13,9 +13,17 @@
|
||||
tox_command_line: '{{ tox_command_line.split() | join(" ") }}'
|
||||
|
||||
|
||||
- name: combine environment variables
|
||||
- name: combine and normalize environment variable values
|
||||
set_fact:
|
||||
tox_env: '{{ tox_environment | from_yaml | combine(tox_constrain_env) }}'
|
||||
tox_env: >
|
||||
{{ tox_env |
|
||||
default({}) |
|
||||
combine({ item.key: (item.value | string).strip() }) }}
|
||||
loop: >
|
||||
{{ ((tox_environment | from_yaml | dict2items) +
|
||||
(tox_constrain_env | dict2items)) }}
|
||||
when:
|
||||
- (item.value | string).strip() # skip empty strings
|
||||
|
||||
- name: show tox variables
|
||||
debug: var="{{ item }}"
|
||||
|
||||
Reference in New Issue
Block a user