Use Python 3 for test web server
authorSimon McVittie <smcv@debian.org>
Wed, 17 Jan 2018 14:20:46 +0000 (14:20 +0000)
committerSimon McVittie <smcv@debian.org>
Wed, 13 Jun 2018 12:04:12 +0000 (13:04 +0100)
The parts of libtest.sh and tests/make-test-runtime.sh that deal with
Python 2 are unaffected: they are only used in the flatpak-builder
tests.

Forwarded: not-needed

Gbp-Pq: Topic debian
Gbp-Pq: Name Use-Python-3-for-test-web-server.patch

tests/test-webserver.sh

index 48e545cb10ff0784e20ac62db40ed4bbd8b5707c..fddc48d5bb1c730e1eb9592770e5a16a89d41a4d 100755 (executable)
@@ -6,7 +6,7 @@ dir=$1
 test_tmpdir=$(pwd)
 
 cd ${dir}
-env PYTHONUNBUFFERED=1 setsid python -m SimpleHTTPServer 0 >${test_tmpdir}/httpd-output &
+env PYTHONUNBUFFERED=1 setsid python3 -m http.server 0 >${test_tmpdir}/httpd-output &
 child_pid=$!
 echo "Web server pid: $child_pid" >&2
 
@@ -18,7 +18,7 @@ for x in $(seq 300); do
     echo >&2
     # If it's non-empty, see whether it matches our regexp
     if test -s ${test_tmpdir}/httpd-output.tmp; then
-        sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output.tmp > ${test_tmpdir}/httpd-port
+        sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) .*,\1,' < ${test_tmpdir}/httpd-output.tmp > ${test_tmpdir}/httpd-port
         if ! cmp ${test_tmpdir}/httpd-output.tmp ${test_tmpdir}/httpd-port 1>/dev/null; then
             # If so, we've successfully extracted the port
             break