aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory P. Smith [Google LLC] <gps@google.com>2021-05-11 19:22:52 -0700
committerGregory P. Smith [Google LLC] <gps@google.com>2021-05-11 19:22:52 -0700
commit1153eb1c96670c73ab8af73f124f66f750612ebe (patch)
tree49a5261f91b22646fa1f4865aac7f8427048db37
parent26420252a40f228a71f3db3fe838fde228ae3c1c (diff)
downloadportpicker-1153eb1c96670c73ab8af73f124f66f750612ebe.tar.gz
Don't test on py2 when unavailable.
-rwxr-xr-xtest.sh24
1 files changed, 14 insertions, 10 deletions
diff --git a/test.sh b/test.sh
index eac4fac..cf53565 100755
--- a/test.sh
+++ b/test.sh
@@ -1,21 +1,25 @@
#!/bin/sh -ex
-echo 'TESTING under Python 2'
-mkdir -p build/test_envs/python2
-virtualenv --python=python2 build/test_envs/python2
-build/test_envs/python2/bin/pip install mock
-# Without --upgrade pip won't copy local changes over to a new test install
-# unless you've updated the package version number.
-build/test_envs/python2/bin/pip install --upgrade .
-build/test_envs/python2/bin/python2 src/tests/portpicker_test.py
-
echo 'TESTING under Python 3'
mkdir -p build/test_envs/python3
-virtualenv --python=python3 build/test_envs/python3
+python3 -m venv build/test_envs/python3
+# Without --upgrade pip won't copy local changes over to a new test install
+# unless you've updated the package version number.
build/test_envs/python3/bin/pip install --upgrade .
build/test_envs/python3/bin/python3 src/tests/portpicker_test.py
echo 'TESTING the portserver'
PYTHONPATH=src build/test_envs/python3/bin/python3 src/tests/portserver_test.py
+if which python2.7 >/dev/null ; then
+echo 'TESTING under Python 2.7'
+mkdir -p build/test_envs/python2
+ python2.7 -m venv build/test_envs/python2
+ build/test_envs/python2/bin/pip install mock
+ build/test_envs/python2/bin/pip install --upgrade .
+ build/test_envs/python2/bin/python2 src/tests/portpicker_test.py
+else
+ echo 'Python 2.7 not found, not testing on that obsolete thing...'
+fi
+
echo PASS