From 0a34d378c972725d821341820d2eddc0ef636612 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Mon, 24 Feb 2020 15:43:45 -0800 Subject: [PATCH] change virtualenv creation when running with python 3 --- .../lib/modules/custom_python_detect_environment.py | 2 +- .../regression/issue_152__virtualenv_python_fails.yml | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/ansible/lib/modules/custom_python_detect_environment.py b/tests/ansible/lib/modules/custom_python_detect_environment.py index 9f628a03..db018202 100644 --- a/tests/ansible/lib/modules/custom_python_detect_environment.py +++ b/tests/ansible/lib/modules/custom_python_detect_environment.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # I am an Ansible new-style Python module. I return details about the Python # interpreter I run within. diff --git a/tests/ansible/regression/issue_152__virtualenv_python_fails.yml b/tests/ansible/regression/issue_152__virtualenv_python_fails.yml index 6df3df12..1d7f39e4 100644 --- a/tests/ansible/regression/issue_152__virtualenv_python_fails.yml +++ b/tests/ansible/regression/issue_152__virtualenv_python_fails.yml @@ -9,7 +9,14 @@ # Can't use pip module because it can't create virtualenvs, must call it # directly. - shell: virtualenv /tmp/issue_152_virtualenv - when: lout.python_version > '2.6' + when: lout.python_version > '2.6' and not lout.python_version.startswith('3') + environment: + https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}" + no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}" + PATH: "{{ lookup('env', 'PATH') }}" + + - shell: python3 -m venv /tmp/issue_152_virtualenv + when: lout.python_version > '2.6' and lout.python_version.startswith('3') environment: https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}" no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"