tests: Fix virtualenv creation on MacOS/OSX

pull/800/head
Alex Willmer 4 years ago
parent 00e5c9ca81
commit 6a4773ac93

@ -14,17 +14,25 @@ steps:
# stuff into. The virtualenv can probably be removed again, but this was a # stuff into. The virtualenv can probably be removed again, but this was a
# hard-fought battle and for now I am tired of this crap. # hard-fought battle and for now I am tired of this crap.
- script: | - script: |
# need wheel before building virtualenv because of bdist_wheel and setuptools deps
# Mac's System Integrity Protection prevents symlinking /usr/bin
# and Azure isn't allowing disabling it apparently: https://developercommunityapi.westus.cloudapp.azure.com/idea/558702/allow-disabling-sip-on-microsoft-hosted-macos-agen.html
# the || will activate when running python3 tests
# TODO: get python3 tests passing # TODO: get python3 tests passing
(sudo ln -fs /usr/bin/python$(python.version) /usr/bin/python && set -o errexit
/usr/bin/python -m pip install -U pip wheel setuptools && set -o nounset
/usr/bin/python -m pip install -U virtualenv && set -o pipefail
/usr/bin/python -m virtualenv /tmp/venv -p /usr/bin/python$(python.version)) || set -x
(sudo /usr/bin/python$(python.version) -m pip install -U pip wheel setuptools &&
/usr/bin/python$(python.version) -m venv /tmp/venv) # Ensure virtualenv is in system-wide $PATH on OSX, for Ansible test tasks
# that use it, e.g. regression/issue_152__virtualenv_python_fails.yml
if [[ -d /Library/Frameworks/Python.framework/Versions/2.7/bin ]]; then
echo $PATH
which python
python -m pip install -U pip virtualenv
ln -s /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv /usr/local/bin/virtualenv
virtualenv --version
fi
# Create virtualenv using desired Python version, to run the testcases
python$(python.version) -m pip install -U pip wheel setuptools virtualenv
python$(python.version) -m virtualenv /tmp/venv -p python$(python.version)
echo "##vso[task.prependpath]/tmp/venv/bin" echo "##vso[task.prependpath]/tmp/venv/bin"
displayName: activate venv displayName: activate venv

@ -13,10 +13,10 @@ jobs:
strategy: strategy:
matrix: matrix:
Mito27_27: Mito27_27:
python.version: '2.7.18' python.version: '2.7'
MODE: mitogen MODE: mitogen
Ans288_27: Ans288_27:
python.version: '2.7.18' python.version: '2.7'
MODE: localhost_ansible MODE: localhost_ansible
VER: 2.8.8 VER: 2.8.8

Loading…
Cancel
Save