zuul-jobs/test-playbooks/ensure-tox.yaml
James E. Blair bac2bf6c45 Revert "ensure-tox: use venv to install"
This reverts commit 6d78fc4f90.

In some environments, this error is being seen:

2020-05-07 18:36:02.139422 | debian-buster |   "msg": "stdout: The virtual environment was not created successfully because ensurepip is not\navailable.  On Debian/Ubuntu systems, you need to install the python3-venv\npackage using the following command.\n\n    apt-get install python3-venv\n\nYou may need to use sudo with that command.  After installing the python3-venv\npackage, recreate your virtual environment.\n\nFailing command: ['/home/zuul/.local/tox/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']\n\n"

Change-Id: I6d38bf16cc38020c53815dfa6ab94f8cab4de0a2
2020-05-08 07:36:40 -07:00

54 lines
1.6 KiB
YAML

- hosts: all
name: Remove any pre-installed tox
tasks:
- name: Remove tox package with pip
shell: pip uninstall -y tox
become: true
failed_when: false
- name: Remove tox package with pip3
shell: pip3 uninstall -y tox
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/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: Install tox inside a virtualenv
pip:
name: tox
virtualenv: "{{ ansible_user_dir }}/tox-venv"
virtualenv_command: "{{ ensure_pip_virtualenv_command }}"
- 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'