From: Simon McVittie Date: Wed, 17 Jan 2018 14:20:46 +0000 (+0000) Subject: Use Python 3 for test web server X-Git-Tag: archive/raspbian/1.0.2-1+rpi1~1^2^2^2^2^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ff1c6965864ac8b566bd0030a823f870d425952e;p=flatpak.git Use Python 3 for test web server 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 --- diff --git a/tests/test-webserver.sh b/tests/test-webserver.sh index 48e545c..fddc48d 100755 --- a/tests/test-webserver.sh +++ b/tests/test-webserver.sh @@ -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