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

56 lines
1.2 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) }}'
- name: "{{ tox_description }}"
command:
chdir: '{{ tox_dir }}'
cmd: '{{ tox_command_line }}'
register:
run_tox
environment: '{{ tox_environment | combine(tox_constrain_env) }}'
ignore_errors: yes
- name: "show test cases results"
debug: var=run_tox.stdout_lines
when:
- (run_tox.stdout_lines | length) > 0
- name:
block:
- name: "show test cases errors"
debug: var=run_tox.stderr_lines
when:
- (run_tox.stderr_lines | length) > 0
- name: 'report test cases failure'
debug:
msg: 'test cases have failed'
failed_when: yes
when:
- run_tox is defined
- run_tox is failed