Update pip integration test to use venv on py3.

This commit is contained in:
Matt Clay 2021-01-07 18:21:28 -08:00
parent 05ba49cbba
commit 456e9b7a33
2 changed files with 24 additions and 14 deletions

View file

@ -1,20 +1,30 @@
# Current pip unconditionally uses md5.
# We can re-enable if pip switches to a different hash or allows us to not check md5.
- name: find virtualenv command
command: "which virtualenv virtualenv-{{ ansible_python.version.major }}.{{ ansible_python.version.minor }}"
register: command
ignore_errors: true
- name: Python 2
when: ansible_python.version.major == 2
block:
- name: find virtualenv command
command: "which virtualenv virtualenv-{{ ansible_python.version.major }}.{{ ansible_python.version.minor }}"
register: command
ignore_errors: true
- name: is virtualenv available to python -m
command: '{{ ansible_python_interpreter }} -m virtualenv'
register: python_m
when: not command.stdout_lines
failed_when: python_m.rc != 2
- name: is virtualenv available to python -m
command: '{{ ansible_python_interpreter }} -m virtualenv'
register: python_m
when: not command.stdout_lines
failed_when: python_m.rc != 2
- name: remember selected virtualenv command
set_fact:
virtualenv: "{{ command.stdout_lines[0] if command is successful else ansible_python_interpreter ~ ' -m virtualenv' }}"
- name: remember selected virtualenv command
set_fact:
virtualenv: "{{ command.stdout_lines[0] if command is successful else ansible_python_interpreter ~ ' -m virtualenv' }}"
- name: Python 3+
when: ansible_python.version.major > 2
block:
- name: remember selected virtualenv command
set_fact:
virtualenv: "{{ ansible_python_interpreter ~ ' -m venv' }}"
- block:
- name: install git, needed for repo installs

View file

@ -521,7 +521,7 @@
### test virtualenv_command begin ###
- name: Test virtualenv command with arguments
when: "ansible_system == 'Linux'"
when: ansible_python.version.major == 2
block:
- name: make sure the virtualenv does not exist
file:
@ -533,7 +533,7 @@
pip:
name: "{{ pip_test_package }}"
virtualenv: "{{ output_dir }}/pipenv"
virtualenv_command: "virtualenv --verbose"
virtualenv_command: "{{ command.stdout_lines[0] | basename }} --verbose"
state: present
register: version13