Run tox by module name (python -m tox)

Change-Id: Iafb1d3efe6d44d58f2c8bf7f72026b4873d725d9
This commit is contained in:
Federico Ressi 2022-02-08 16:26:41 +01:00
parent 84b2561afd
commit 71483d333d
2 changed files with 7 additions and 23 deletions

View File

@ -38,7 +38,7 @@
- name: "run Tox InfraRed plugin"
shell:
cmd: >
'{{ tox_executable }}' -e infrared -- --collect-dir '{{ test_collect_dir }}'
{{ tox_executable }} -e infrared -- --collect-dir '{{ test_collect_dir }}'
chdir: '{{ test_dir }}'
ignore_errors: yes
register: run_tox

View File

@ -1,39 +1,23 @@
---
- name: "ensure Tox is installed"
command: |
'{{ python_executable }}' -m pip install --user 'tox>={{ tox_min_version }}'
command: >
{{ python_executable }} -m pip install --user 'tox>={{ tox_min_version }}'
register: install_tox
changed_when: "'Successfully installed' in install_tox.stdout"
- block:
- name: "get '{{ tox_command }}' full path"
shell: |
export PATH={{ python_exe_path }}
which '{{ tox_command }}'
register: get_tox_path
- name: "set tox_executable fact"
set_fact:
tox_executable: '{{ get_tox_path.stdout_lines | first }}'
rescue:
- name: "set tox_executable fact"
set_fact:
tox_executable: '{{ ansible_user_dir }}/.local/bin/tox'
- name: "set tox_executable fact"
set_fact:
tox_executable: "{{ python_executable }} -m tox"
- name: "get installed Tox version"
command: "'{{ tox_executable }}' --version"
command: "{{ tox_executable }} --version"
register: get_tox_version
- name: "update tox_version fact"
set_fact:
tox_version: '{{ get_tox_version.stdout_lines | first }}'
- name: "show Tox facts"
debug:
msg: