tobiko/roles/tobiko-tox/tasks/tox.yaml

57 lines
1.3 KiB
YAML

---
- name: "set Tox command line fact"
set_fact:
tox_command_line: >
{{ tox_command }}
{% if tox_envlist %} -e {{ tox_envlist | quote }} {% endif %}
{{ tox_extra_args }}
- name: "normalize white spaces from Tox command line"
set_fact:
tox_command_line: '{{ tox_command_line.split() | join(" ") }}'
- name: "show tox variables"
debug:
msg:
tox_command_line: '{{ tox_command_line }}'
tox_description: '{{ tox_description }}'
tox_dir: '{{ tox_dir }}'
tox_environment: '{{ tox_environment | combine(tox_constrain_env) }}'
tox_expected_rcs: '{{ tox_expected_rcs }}'
- name: "{{ tox_description }}"
command:
chdir: '{{ tox_dir }}'
cmd: '{{ tox_command_line }}'
register:
run_tox
environment: '{{ tox_environment | combine(tox_constrain_env) }}'
failed_when: run_tox.rc != tox_succeeded_rc
ignore_errors: yes
- name: "show test cases output"
debug: var=run_tox.stdout_lines
when:
- (run_tox.stdout_lines | length) > 0
- name: "show test cases errors"
debug: var=run_tox.stderr_lines
when:
- run_tox is failed
- (run_tox.stderr_lines | length) > 0
- name: 'raise test cases failure'
debug:
msg: 'test cases have failed'
when: run_tox is failed
failed_when:
- not (ignore_test_failures | bool)
- run_tox.rc not in tox_expected_rcs