From 4be671b2108865a065c2b9fff04c4840c5b915a9 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 17 Jan 2018 14:20:46 +0000 Subject: [PATCH] Use Python 3 for tests Forwarded: not-needed Gbp-Pq: Topic debian Gbp-Pq: Name Use-Python-3-for-test-web-server.patch --- tests/http-utils-test-server.py | 2 +- tests/oci-registry-client.py | 2 +- tests/oci-registry-server.py | 2 +- tests/test-http-utils.sh | 2 +- tests/test-oci-registry.sh | 4 ++-- tests/test-webserver.sh | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/http-utils-test-server.py b/tests/http-utils-test-server.py index ec3826d..03f0ac3 100644 --- a/tests/http-utils-test-server.py +++ b/tests/http-utils-test-server.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 from wsgiref.handlers import format_date_time from email.utils import parsedate diff --git a/tests/oci-registry-client.py b/tests/oci-registry-client.py index 2312a99..06db4cc 100644 --- a/tests/oci-registry-client.py +++ b/tests/oci-registry-client.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 from __future__ import print_function diff --git a/tests/oci-registry-server.py b/tests/oci-registry-server.py index aa3045e..fa46358 100644 --- a/tests/oci-registry-server.py +++ b/tests/oci-registry-server.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 from __future__ import print_function diff --git a/tests/test-http-utils.sh b/tests/test-http-utils.sh index 45c2c9d..1bf36a6 100755 --- a/tests/test-http-utils.sh +++ b/tests/test-http-utils.sh @@ -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) diff --git a/tests/test-oci-registry.sh b/tests/test-oci-registry.sh index d32f7e6..623e55d 100755 --- a/tests/test-oci-registry.sh +++ b/tests/test-oci-registry.sh @@ -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 diff --git a/tests/test-webserver.sh b/tests/test-webserver.sh index 6d10b01..1b0fb8b 100755 --- a/tests/test-webserver.sh +++ b/tests/test-webserver.sh @@ -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 -- 2.30.2