zuul-jobs/test-playbooks/ensure-tox.yaml
Ian Wienand a016a1a565 linters: standardise on newline at end of file
I noticed this by accident when I ran ansible-lint over this repo from
an outside context; it didn't use the .yamllint in here and started
compalining about eof whitespace.

After scratching my head for a bit as to why this didn't fail here, I
realised we've allowed various newlines since the initial commit
I936fe2c997597972d884c5fc62655d28e8aaf8c5.

Remove this and just use the default eof rules, and fixup the
whitespace as required.  This is fairly unimportant, but is nice for
consistency.

Change-Id: Idb46a1f39ba798b0bf70eaa27b4c6b4758ce3d26
2022-07-28 16:19:06 +10:00

56 lines
1.7 KiB
YAML

- hosts: all
name: Remove any pre-installed tox
tasks:
- name: Remove tox package with pip
shell: pip uninstall -y tox
args:
warn: false
become: true
failed_when: false
- name: Remove tox package with pip3
shell: pip3 uninstall -y tox
args:
warn: false
become: true
failed_when: false
- name: Verify tox is not installed
command: "tox --version"
register: result
failed_when: result.rc == 0
- hosts: all
name: Test ensure-tox installs into user environment
tasks:
- name: Verify tox is not installed
command: "tox --version"
register: result
failed_when: result.rc == 0
- name: Run ensure-tox with tox not installed
include_role:
name: ensure-tox
- name: Verify tox_executable is set
assert:
that:
- tox_executable == "{{ ansible_user_dir }}/.local/tox/bin/tox"
- name: Verify tox is installed
command: "{{ tox_executable }} --version"
register: result
failed_when: result.rc != 0
- hosts: all
name: Test ensure-tox when tox_executable is set to an already installed tox
tasks:
- name: Create a virtualenv
command: '{{ ensure_pip_virtualenv_command }} {{ ansible_user_dir }}/tox-venv'
- name: Install tox to local venv
command: '{{ ansible_user_dir }}/tox-venv/bin/pip install tox'
- name: Run ensure-tox pointing to an already installed tox
include_role:
name: ensure-tox
vars:
tox_executable: "{{ ansible_user_dir }}/tox-venv/bin/tox"
- name: Verify tox_executable is set to the virtualenv tox
assert:
that:
- tox_executable == '{{ ansible_user_dir }}/tox-venv/bin/tox'