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, 17 Jan 2018 20:55:34 +0000 (20:55 +0000)
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 2964ce96cbd129222af2ec850140991aab6531f2..c1f26d039f67b9d5940cdb555f95be564e90c5d1 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=$!
 
 for x in $(seq 50); do
@@ -14,7 +14,7 @@ for x in $(seq 50); do
     cp ${test_tmpdir}/httpd-output{,.tmp}
     # 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