Skip to content

Commit f674ac1

Browse files
author
Benjamin Moody
committed
test-upgrade.sh: install python libraries without upgrading.
We want to avoid "upgrading" python libraries using pip, because this may not give predictable results, and if installation fails it can leave the system in a broken half-installed state. Instead, we want to install packages from scratch whenever it is required. To be consistent with the new behavior of the git update hook, do the same thing when running upgrade tests: rather than "upgrading" the virtualenv directory, delete the old one and create a new one. This makes caching simpler, too, since the directory contents should be reproducible just from requirements.txt.
1 parent 33d3689 commit f674ac1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test-upgrade.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,14 @@ export PATH=$venvdir/bin:$PATH
266266

267267
msg_testing "Installing new requirements"
268268
if ! cmp -s "$olddir/requirements.txt" "$topdir/requirements.txt"; then
269-
cachefile=$venvcachedir/$old_reqs_hash-$new_reqs_hash.tar.gz
269+
prereq_cmd rm -rf "$venvdir"
270+
cachefile=$venvcachedir/$new_reqs_hash.tar.gz
270271
if [ -n "$venvcachedir" ] && [ -f "$cachefile" ]; then
271-
prereq_cmd rm -rf "$venvdir"
272272
prereq_cmd mkdir "$venvdir"
273273
prereq_cmd tar -xzf "$cachefile" -C "$venvdir"
274274
else
275+
prereq_cmd virtualenv --quiet --quiet \
276+
--no-download -ppython3 "$venvdir"
275277
prereq_cmd pip3 install --require-hashes \
276278
-r "$topdir/requirements.txt"
277279
if [ -n "$venvcachedir" ]; then

0 commit comments

Comments
 (0)