Use Python 3 for tests
authorSimon McVittie <smcv@debian.org>
Wed, 17 Jan 2018 14:20:46 +0000 (14:20 +0000)
committerSimon McVittie <smcv@debian.org>
Sat, 15 Sep 2018 10:41:26 +0000 (11:41 +0100)
Forwarded: not-needed

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

tests/http-utils-test-server.py
tests/oci-registry-client.py
tests/oci-registry-server.py
tests/test-http-utils.sh
tests/test-oci-registry.sh
tests/test-webserver.sh

index ec3826d6c2d25c4b3d6c5f49cfe05ccde3d2be2f..03f0ac394ab2f08120217eac515869d30ef5f278 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 from wsgiref.handlers import format_date_time
 from email.utils import parsedate
index 2312a99822f3d560b698a832b7fc61a19b7cc51a..06db4cc421e458a767c2dd99fb6f5be3ade2f2df 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 from __future__ import print_function
 
index aa3045e18ca584e2f973072ae464ddef0aa60fed..fa463586d3b1e3a44715b2324d96c385025e5427 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 from __future__ import print_function
 
index 45c2c9d35c8a864828779b2eb730c6b93abd7728..1bf36a6f2599e07c99c6b1a3aa6cea70188f7de3 100755 (executable)
@@ -21,7 +21,7 @@ set -euo pipefail
 
 . $(dirname $0)/libtest.sh
 
-$(dirname $0)/test-webserver.sh "" "python $test_srcdir/http-utils-test-server.py 0"
+$(dirname $0)/test-webserver.sh "" "python3 $test_srcdir/http-utils-test-server.py 0"
 FLATPAK_HTTP_PID=$(cat httpd-pid)
 mv httpd-port httpd-port-main
 port=$(cat httpd-port-main)
index d32f7e6b3e5d3abb065023d5fa974fd87610ec13..623e55d5b69bfe22bb46a4f63cd42f931d931677 100755 (executable)
@@ -27,11 +27,11 @@ echo "1..13"
 
 # Start the fake registry server
 
-$(dirname $0)/test-webserver.sh "" "python $test_srcdir/oci-registry-server.py 0"
+$(dirname $0)/test-webserver.sh "" "python3 $test_srcdir/oci-registry-server.py 0"
 FLATPAK_HTTP_PID=$(cat httpd-pid)
 mv httpd-port httpd-port-main
 port=$(cat httpd-port-main)
-client="python $test_srcdir/oci-registry-client.py 127.0.0.1:$port"
+client="python3 $test_srcdir/oci-registry-client.py 127.0.0.1:$port"
 
 setup_repo_no_add oci
 
index 6d10b011a91695bb4455ff0aa47f671f9ac7a202..1b0fb8b2453086e9ceb8ae8cfa3b18041e195e11 100755 (executable)
@@ -3,7 +3,7 @@
 set -euo pipefail
 
 dir=$1
-cmd=${2:-python -m SimpleHTTPServer 0}
+cmd=${2:-python3 -m http.server 0}
 test_tmpdir=$(pwd)
 
 [ "$dir" != "" ] && cd ${dir}
@@ -21,7 +21,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