aboutsummaryrefslogtreecommitdiff
path: root/test.sh
diff options
context:
space:
mode:
authorGregory P. Smith <gps@google.com>2021-05-24 15:29:39 -0700
committerGitHub <noreply@github.com>2021-05-24 15:29:39 -0700
commitc33bdd51b8d2e0a24b05a17b8e9b2192f0977dc8 (patch)
tree1eb21d5e1153f19e6c3626f251d6644c1dc9450f /test.sh
parent2f3d53514ea498517ff004b5fa48a3fd37e39f9e (diff)
downloadportpicker-c33bdd51b8d2e0a24b05a17b8e9b2192f0977dc8.tar.gz
Fixes to support Python 3.10, require 3.6+ (#24)
Switch from asyncio.coroutine to async def to support 3.10. https://www.python.org/dev/peps/pep-0492/ Drop the use of the loop= parameter in portserver for 3.10. Refactor portserver_test to launch a subprocess instead of mock. This will wind up as 1.4.0. Use tox for our testing. Test on 3.10 in CI. Require 3.6+. Add a package.sh.
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh30
1 files changed, 6 insertions, 24 deletions
diff --git a/test.sh b/test.sh
index cbd0c69..9407f7c 100755
--- a/test.sh
+++ b/test.sh
@@ -1,27 +1,9 @@
#!/bin/sh -ex
-if which python3 >/dev/null ; then
- echo 'TESTING under Python 3'
- mkdir -p 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 pip
- build/test_envs/python3/bin/pip install --upgrade .
- build/test_envs/python3/bin/python3 src/tests/portpicker_test.py
+unset PYTHONPATH
+python3 -m venv build/venv
+. build/venv/bin/activate
- echo 'TESTING the portserver'
- PYTHONPATH=src build/test_envs/python3/bin/python3 src/tests/portserver_test.py
-fi
-
-if which python2.7 >/dev/null ; then
- echo 'TESTING under Python 2.7'
- mkdir -p build/test_envs/python2
- virtualenv --python=python2.7 build/test_envs/python2
- build/test_envs/python2/bin/pip install mock
- build/test_envs/python2/bin/pip install --upgrade pip
- build/test_envs/python2/bin/pip install --upgrade .
- build/test_envs/python2/bin/python2 src/tests/portpicker_test.py
-fi
-
-echo PASS
+pip install --upgrade pip
+pip install tox
+tox -e "py3$(python -c 'import sys; print(sys.version_info.minor)')"