From 74797e4291750a08f5ece97053c041050691a89e Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sun, 26 Apr 2020 14:42:30 +0200 Subject: [PATCH] Use "pip -m install" Currently, we are overriding 'install_command' to use 'pip'. This is considered poor behavior and 'python -m pip' should be used instead: https://snarky.ca/why-you-should-use-python-m-pip/ It turns out that this is the the default value provided by tox: https://tox.readthedocs.io/en/latest/config.html#conf-install_command So we can remove the line and simply use the default value - after adding constraints to deps as is best practice as well. Mosts tests itself use "pip install" in the shell scripts which sets also the constraints. Change that to "python -m pip install" like done for tox. Change-Id: I27f80d8aa4ac3688ee56e8a9234e34f4e09afe34 --- run_tests_common.sh | 2 +- test-ansible-env-prep.sh | 2 +- tox.ini | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/run_tests_common.sh b/run_tests_common.sh index c8d29e4f..36bbe208 100755 --- a/run_tests_common.sh +++ b/run_tests_common.sh @@ -96,7 +96,7 @@ if [[ "${ID,,}" == "fedora" ]]; then sudo dnf -y install redhat-lsb-core yum-utils # openSUSE 42.1 does not have python-ndg-httpsclient elif [[ "${ID,,}" == *suse* ]] && [[ ${VERSION} == "42.1" ]]; then - sudo pip install ndg-httpsclient + sudo python -m pip install ndg-httpsclient fi # Get a list of packages to install with bindep. If packages need to be diff --git a/test-ansible-env-prep.sh b/test-ansible-env-prep.sh index a404a7a9..bc8b5eb1 100755 --- a/test-ansible-env-prep.sh +++ b/test-ansible-env-prep.sh @@ -197,7 +197,7 @@ else fi # Install all python packages -pip install ${PIP_OPTS} +python -m pip install ${PIP_OPTS} # Download the Ansible role repositories if they are not present on the host. # This is ignored if there is no ansible-role-requirements file. diff --git a/tox.ini b/tox.ini index 7ddfb51b..9d9f0a50 100644 --- a/tox.ini +++ b/tox.ini @@ -6,8 +6,6 @@ envlist = docs,linters,func [testenv] basepython = python3 usedevelop = True -install_command = - pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/upper-constraints.txt} {opts} {packages} commands = /usr/bin/find . -type f -name "*.pyc" -delete passenv = @@ -27,7 +25,9 @@ setenv = WORKING_DIR={toxinidir} [testenv:docs] -deps = -r{toxinidir}/doc/requirements.txt +deps = + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt commands = bash -c "rm -rf doc/build" doc8 doc @@ -45,7 +45,7 @@ commands = extensions = .rst [testenv:releasenotes] -deps = -r{toxinidir}/doc/requirements.txt +deps = {[testenv:docs]deps} commands = sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html