[devscripts] 01/01: uscan: test scripts migrate to python3

Osamu Aoki osamu at moszumanska.debian.org
Tue Jan 23 14:44:38 UTC 2018


This is an automated email from the git hooks/post-receive script.

osamu pushed a commit to branch master
in repository devscripts.

commit 240cae9a19c5532ab418bc63fcaca5231de1a470
Author: Osamu Aoki <osamu at debian.org>
Date:   Tue Jan 23 23:37:48 2018 +0900

    uscan: test scripts migrate to python3
    
    Signed-off-by: Osamu Aoki <osamu at debian.org>
---
 test/test_uscan           |  2 +-
 test/test_uscan_mangle    |  2 +-
 test/uscan/server-head.py | 14 +++++++-------
 test/uscan/server.py      |  8 ++++----
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/test/test_uscan b/test/test_uscan
index 7fafd12..944c014 100755
--- a/test/test_uscan
+++ b/test/test_uscan
@@ -55,7 +55,7 @@ spawnHttpServer(){
     (
 	mkdir -p $TMPDIR/repo
 	cd $TMPDIR/repo
-	python "$test_dir/uscan/server.py" &
+	python3 "$test_dir/uscan/server.py" &
 	echo $! > pid
 	while ! [ -s port ]; do
 	    :
diff --git a/test/test_uscan_mangle b/test/test_uscan_mangle
index 05f1dfc..9afdabb 100755
--- a/test/test_uscan_mangle
+++ b/test/test_uscan_mangle
@@ -97,7 +97,7 @@ spawnHttpServer(){
 	USCAN_HTTP_SERVER=${USCAN_HTTP_SERVER:-server.py}
 	mkdir -p $TMPDIR/$REPOPATH
 	cd $TMPDIR/$REPOPATH
-	python "$test_dir/uscan/$USCAN_HTTP_SERVER" 2>log &
+	python3 "$test_dir/uscan/$USCAN_HTTP_SERVER" 2>log &
 	echo $! > pid
 	while ! [ -s port ]; do
 	    :
diff --git a/test/uscan/server-head.py b/test/uscan/server-head.py
index 3d1c796..13daf4d 100644
--- a/test/uscan/server-head.py
+++ b/test/uscan/server-head.py
@@ -1,16 +1,16 @@
-#!/usr/bin/python
-import BaseHTTPServer
-import SimpleHTTPServer
+#!/usr/bin/python3
+import http.server
+from http.server import SimpleHTTPRequestHandler
 import logging
 
-class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+class GetHandler(SimpleHTTPRequestHandler):
     def do_GET(self):
-	logging.error(self.headers)
-        SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
+        logging.error(self.headers)
+        SimpleHTTPRequestHandler.do_GET(self)
 
 def test():
     Handler = GetHandler
-    httpd = BaseHTTPServer.HTTPServer(('', 0), Handler)
+    httpd = http.server.HTTPServer(('', 0), Handler)
 
     sa = httpd.socket.getsockname()
     with open('port', 'w') as f:
diff --git a/test/uscan/server.py b/test/uscan/server.py
index 7309288..b9cf832 100644
--- a/test/uscan/server.py
+++ b/test/uscan/server.py
@@ -1,10 +1,10 @@
-#!/usr/bin/python
-import BaseHTTPServer
-from SimpleHTTPServer import SimpleHTTPRequestHandler
+#!/usr/bin/python3
+import http.server
+from http.server import SimpleHTTPRequestHandler
 
 def test():
     SimpleHTTPRequestHandler.protocol_version='HTTP/1.0'
-    httpd = BaseHTTPServer.HTTPServer(('', 0), SimpleHTTPRequestHandler)
+    httpd = http.server.HTTPServer(('', 0), SimpleHTTPRequestHandler)
 
     sa = httpd.socket.getsockname()
     with open('port', 'w') as f:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list