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

View file

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