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

62 lines
1.3 KiB
YAML

---
- name: "set 'PYTHON={{ tox_python }}' in Tox environment variables"
set_fact:
tox_environment: >
{{ tox_environment | combine({ "PYTHON": (tox_python or "") }) }}
when:
- tox_python is defined
- name: "show tox environment"
debug: var=tox_environment
- name: "normalize white spaces from Tox command line"
set_fact:
tox_command_line: '{{ tox_command_line.split() | join(" ") }}'
- name: "run Tox on direcory '{{ tox_dir }}': '{{ tox_command_line }}'"
command:
chdir: '{{ tox_dir }}'
cmd: '{{ tox_command_line }}'
register:
run_tox
environment: '{{ tox_environment }}'
ignore_errors: yes
- name: "show test cases results"
debug: var=run_tox.stdout_lines
when:
- (run_tox.stdout_lines | length) > 0
- name: "generate test case report files"
shell:
chdir: "{{ tobiko_dir }}"
cmd: |
{{ tox_command }} -e report
register:
make_report
environment: '{{ tox_report_env }}'
ignore_errors: yes
- 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