From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 2C7A11381F3 for ; Tue, 2 Jul 2013 14:49:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 52B26E0A6F; Tue, 2 Jul 2013 14:49:01 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C9C0BE0A6F for ; Tue, 2 Jul 2013 14:49:00 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C3BF033E84B for ; Tue, 2 Jul 2013 14:48:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 642AFE5462 for ; Tue, 2 Jul 2013 14:48:58 +0000 (UTC) From: "Jauhien Piatlicki" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jauhien Piatlicki" Message-ID: <1372776591.ab7e4b9f72ac3fcf90a04d1743a2823e431ed0ef.jauhien@gentoo> Subject: [gentoo-commits] proj/g-sorcery:master commit in: tests/ X-VCS-Repository: proj/g-sorcery X-VCS-Files: tests/server.py X-VCS-Directories: tests/ X-VCS-Committer: jauhien X-VCS-Committer-Name: Jauhien Piatlicki X-VCS-Revision: ab7e4b9f72ac3fcf90a04d1743a2823e431ed0ef X-VCS-Branch: master Date: Tue, 2 Jul 2013 14:48:58 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: fbf93a51-c27f-4448-b171-82da686ec15b X-Archives-Hash: 78e572ec020a38e5804712375e254f24 commit: ab7e4b9f72ac3fcf90a04d1743a2823e431ed0ef Author: Jauhien Piatlicki (jauhien) gmail com> AuthorDate: Tue Jul 2 14:49:51 2013 +0000 Commit: Jauhien Piatlicki gmail com> CommitDate: Tue Jul 2 14:49:51 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=ab7e4b9f py2k: tests/server --- tests/server.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/server.py b/tests/server.py index ef17849..41767fc 100644 --- a/tests/server.py +++ b/tests/server.py @@ -11,13 +11,23 @@ :license: GPL-2, see LICENSE for more details. """ -import http.server, threading +import threading + +from g_sorcery.compatibility import py2k + +if py2k: + from SocketServer import TCPServer as HTTPServer + from SimpleHTTPServer import SimpleHTTPRequestHandler +else: + from http.server import HTTPServer + from http.server import SimpleHTTPRequestHandler class Server(threading.Thread): def __init__(self): super(Server, self).__init__() + HTTPServer.allow_reuse_address = True server_address = ('127.0.0.1', 8080) - self.httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler) + self.httpd = HTTPServer(server_address, SimpleHTTPRequestHandler) def run(self): self.httpd.serve_forever()