Install test-requirements with main install

To reduce the total number of invocations necessary for pip which isn't
the quickest thing ever (due to needing to evaluate constraints and deps
lists and what is currently installed) combine the main installation of
software with its test-requirements.txt file which should roughly halve
our pip invocations.

Change-Id: Ibcc3264136e66d34a879ad1c90a62e1bb6a84243
This commit is contained in:
Clark Boylan 2017-06-12 14:57:59 -07:00
parent 9234316794
commit f266a2dc81

View File

@ -320,6 +320,14 @@ function pip_install {
fi fi
$xtrace $xtrace
# Also install test requirements
local install_test_reqs=""
local test_req="${!#}/test-requirements.txt"
if [[ -e "$test_req" ]]; then
install_test_reqs="-r $test_req"
fi
# adding SETUPTOOLS_SYS_PATH_TECHNIQUE is a workaround to keep # adding SETUPTOOLS_SYS_PATH_TECHNIQUE is a workaround to keep
# the same behaviour of setuptools before version 25.0.0. # the same behaviour of setuptools before version 25.0.0.
# related issue: https://github.com/pypa/pip/issues/3874 # related issue: https://github.com/pypa/pip/issues/3874
@ -329,24 +337,10 @@ function pip_install {
no_proxy="${no_proxy:-}" \ no_proxy="${no_proxy:-}" \
PIP_FIND_LINKS=$PIP_FIND_LINKS \ PIP_FIND_LINKS=$PIP_FIND_LINKS \
SETUPTOOLS_SYS_PATH_TECHNIQUE=rewrite \ SETUPTOOLS_SYS_PATH_TECHNIQUE=rewrite \
$cmd_pip $upgrade \ $cmd_pip $upgrade $install_test_reqs \
$@ $@
result=$? result=$?
# Also install test requirements
local test_req="${!#}/test-requirements.txt"
if [[ $result == 0 ]] && [[ -e "$test_req" ]]; then
echo "Installing test-requirements for $test_req"
$sudo_pip \
http_proxy=${http_proxy:-} \
https_proxy=${https_proxy:-} \
no_proxy=${no_proxy:-} \
PIP_FIND_LINKS=$PIP_FIND_LINKS \
$cmd_pip $upgrade \
-r $test_req
result=$?
fi
time_stop "pip_install" time_stop "pip_install"
return $result return $result
} }