Fix pip test to use setup_remote_tmp_dir.

pull/76229/head
Matt Clay 3 years ago
parent a861cb5607
commit 39509ff216

@ -1,2 +1,3 @@
dependencies: dependencies:
- prepare_tests - prepare_tests
- setup_remote_tmp_dir

@ -88,24 +88,24 @@
- name: "make sure the test env doesn't exist" - name: "make sure the test env doesn't exist"
file: file:
state: absent state: absent
name: "{{ output_dir }}/pipenv" name: "{{ remote_tmp_dir }}/pipenv"
- name: install a working version of setuptools in the virtualenv - name: install a working version of setuptools in the virtualenv
pip: pip:
name: setuptools name: setuptools
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
version: 33.1.1 version: 33.1.1
- name: create a requirement file with an vcs url - name: create a requirement file with an vcs url
copy: copy:
dest: "{{ output_dir }}/pipreq.txt" dest: "{{ remote_tmp_dir }}/pipreq.txt"
content: "-e git+https://github.com/dvarrazzo/pyiso8601#egg=iso8601" content: "-e git+https://github.com/dvarrazzo/pyiso8601#egg=iso8601"
- name: install the requirement file in a virtualenv - name: install the requirement file in a virtualenv
pip: pip:
requirements: "{{ output_dir}}/pipreq.txt" requirements: "{{ remote_tmp_dir}}/pipreq.txt"
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
register: req_installed register: req_installed
- name: check that a change occurred - name: check that a change occurred
@ -115,8 +115,8 @@
- name: "repeat installation to check status didn't change" - name: "repeat installation to check status didn't change"
pip: pip:
requirements: "{{ output_dir}}/pipreq.txt" requirements: "{{ remote_tmp_dir}}/pipreq.txt"
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
register: req_installed register: req_installed
- name: "check that a change didn't occurr this time (bug ansible#1705)" - name: "check that a change didn't occurr this time (bug ansible#1705)"
@ -127,7 +127,7 @@
- name: install the same module from url - name: install the same module from url
pip: pip:
name: "git+https://github.com/dvarrazzo/pyiso8601#egg=iso8601" name: "git+https://github.com/dvarrazzo/pyiso8601#egg=iso8601"
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
editable: True editable: True
register: url_installed register: url_installed
@ -142,13 +142,13 @@
- name: check for pip package - name: check for pip package
pip: pip:
name: pip name: pip
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
- name: check for pip package in check_mode - name: check for pip package in check_mode
pip: pip:
name: pip name: pip
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
check_mode: True check_mode: True
register: pip_check_mode register: pip_check_mode
@ -162,13 +162,13 @@
- name: check for setuptools package - name: check for setuptools package
pip: pip:
name: setuptools name: setuptools
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
- name: check for setuptools package in check_mode - name: check for setuptools package in check_mode
pip: pip:
name: setuptools name: setuptools
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
check_mode: True check_mode: True
register: setuptools_check_mode register: setuptools_check_mode
@ -183,13 +183,13 @@
- name: check for q package - name: check for q package
pip: pip:
name: q name: q
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
- name: check for q package in check_mode - name: check for q package in check_mode
pip: pip:
name: q name: q
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
check_mode: True check_mode: True
register: q_check_mode register: q_check_mode
@ -204,13 +204,13 @@
- name: check for Junit-XML package - name: check for Junit-XML package
pip: pip:
name: Junit-XML name: Junit-XML
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
- name: check for Junit-XML package in check_mode - name: check for Junit-XML package in check_mode
pip: pip:
name: Junit-XML name: Junit-XML
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
check_mode: True check_mode: True
register: diff_case_check_mode register: diff_case_check_mode
@ -224,12 +224,12 @@
- name: ensure is a fresh virtualenv - name: ensure is a fresh virtualenv
file: file:
state: absent state: absent
name: "{{ output_dir }}/pipenv" name: "{{ remote_tmp_dir }}/pipenv"
- name: install pip throught pip into fresh virtualenv - name: install pip throught pip into fresh virtualenv
pip: pip:
name: pip name: pip
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
register: pip_install_venv register: pip_install_venv
- name: make sure pip in fresh virtualenv report changed - name: make sure pip in fresh virtualenv report changed
@ -242,7 +242,7 @@
- name: create chdir test directories - name: create chdir test directories
file: file:
state: directory state: directory
name: "{{ output_dir }}/{{ item }}" name: "{{ remote_tmp_dir }}/{{ item }}"
loop: loop:
- pip_module - pip_module
- pip_root - pip_root
@ -251,7 +251,7 @@
- name: copy test module - name: copy test module
copy: copy:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ output_dir }}/pip_module/{{ item }}" dest: "{{ remote_tmp_dir }}/pip_module/{{ item }}"
loop: loop:
- setup.py - setup.py
- ansible_test_pip_chdir/__init__.py - ansible_test_pip_chdir/__init__.py
@ -259,8 +259,8 @@
- name: install test module - name: install test module
pip: pip:
name: . name: .
chdir: "{{ output_dir }}/pip_module" chdir: "{{ remote_tmp_dir }}/pip_module"
extra_args: --user --upgrade --root {{ output_dir }}/pip_root extra_args: --user --upgrade --root {{ remote_tmp_dir }}/pip_root
- name: register python_site_lib - name: register python_site_lib
command: '{{ ansible_python.executable }} -c "import site; print(site.USER_SITE)"' command: '{{ ansible_python.executable }} -c "import site; print(site.USER_SITE)"'
@ -271,7 +271,7 @@
register: pip_python_user_base register: pip_python_user_base
- name: run test module - name: run test module
shell: "PYTHONPATH=$(echo {{ output_dir }}/pip_root{{ pip_python_site_lib.stdout }}) {{ output_dir }}/pip_root{{ pip_python_user_base.stdout }}/bin/ansible_test_pip_chdir" shell: "PYTHONPATH=$(echo {{ remote_tmp_dir }}/pip_root{{ pip_python_site_lib.stdout }}) {{ remote_tmp_dir }}/pip_root{{ pip_python_user_base.stdout }}/bin/ansible_test_pip_chdir"
register: pip_chdir_command register: pip_chdir_command
- name: make sure command ran - name: make sure command ran
@ -283,12 +283,12 @@
- name: ensure is a fresh virtualenv - name: ensure is a fresh virtualenv
file: file:
state: absent state: absent
name: "{{ output_dir }}/pipenv" name: "{{ remote_tmp_dir }}/pipenv"
- name: install requirements file into virtual + chdir - name: install requirements file into virtual + chdir
pip: pip:
name: q name: q
chdir: "{{ output_dir }}/" chdir: "{{ remote_tmp_dir }}/"
virtualenv: "pipenv" virtualenv: "pipenv"
state: present state: present
register: venv_chdir register: venv_chdir
@ -314,14 +314,14 @@
- name: Ensure previous virtualenv no longer exists - name: Ensure previous virtualenv no longer exists
file: file:
state: absent state: absent
name: "{{ output_dir }}/pipenv" name: "{{ remote_tmp_dir }}/pipenv"
- name: do not consider an empty string as a version - name: do not consider an empty string as a version
pip: pip:
name: q name: q
state: present state: present
version: "" version: ""
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
register: pip_empty_version_string register: pip_empty_version_string
- name: test idempotency with empty string - name: test idempotency with empty string
@ -329,14 +329,14 @@
name: q name: q
state: present state: present
version: "" version: ""
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
register: pip_empty_version_string_idempotency register: pip_empty_version_string_idempotency
- name: test idempotency without empty string - name: test idempotency without empty string
pip: pip:
name: q name: q
state: present state: present
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
register: pip_no_empty_version_string_idempotency register: pip_no_empty_version_string_idempotency
# 'present' and version=="" is analogous to latest when first installed # 'present' and version=="" is analogous to latest when first installed
@ -344,7 +344,7 @@
pip: pip:
name: q name: q
state: latest state: latest
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
register: pip_empty_version_idempotency register: pip_empty_version_idempotency
- name: ensure that installation worked and is idempotent - name: ensure that installation worked and is idempotent
@ -526,7 +526,7 @@
- name: make sure the virtualenv does not exist - name: make sure the virtualenv does not exist
file: file:
state: absent state: absent
name: "{{ output_dir }}/pipenv" name: "{{ remote_tmp_dir }}/pipenv"
- name: install distribute in the virtualenv - name: install distribute in the virtualenv
pip: pip:
@ -535,14 +535,14 @@
name: name:
- distribute - distribute
- setuptools<45 # setuptools 45 and later require python 3.5 or later - setuptools<45 # setuptools 45 and later require python 3.5 or later
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present state: present
- name: try to remove distribute - name: try to remove distribute
pip: pip:
state: "absent" state: "absent"
name: "distribute" name: "distribute"
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
ignore_errors: yes ignore_errors: yes
register: remove_distribute register: remove_distribute
@ -559,13 +559,13 @@
- name: make sure the virtualenv does not exist - name: make sure the virtualenv does not exist
file: file:
state: absent state: absent
name: "{{ output_dir }}/pipenv" name: "{{ remote_tmp_dir }}/pipenv"
# ref: https://github.com/ansible/ansible/issues/52275 # ref: https://github.com/ansible/ansible/issues/52275
- name: install using virtualenv_command with arguments - name: install using virtualenv_command with arguments
pip: pip:
name: "{{ pip_test_package }}" name: "{{ pip_test_package }}"
virtualenv: "{{ output_dir }}/pipenv" virtualenv: "{{ remote_tmp_dir }}/pipenv"
virtualenv_command: "{{ command.stdout_lines[0] | basename }} --verbose" virtualenv_command: "{{ command.stdout_lines[0] | basename }} --verbose"
state: present state: present
register: version13 register: version13

Loading…
Cancel
Save