diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/roles/test_uri/files/testserver.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test/integration/roles/test_uri/files/testserver.py b/test/integration/roles/test_uri/files/testserver.py index d0d24a0050..1488c814af 100644 --- a/test/integration/roles/test_uri/files/testserver.py +++ b/test/integration/roles/test_uri/files/testserver.py @@ -1,7 +1,17 @@ -import mimetypes +import sys if __name__ == '__main__': - mimetypes.init() - mimetypes.add_type('application/json', '.json') - import SimpleHTTPServer - SimpleHTTPServer.test() + if sys.version_info[0] >= 3: + import http.server + import socketserver + PORT = int(sys.argv[1]) + Handler = http.server.SimpleHTTPRequestHandler + httpd = socketserver.TCPServer(("", PORT), Handler) + httpd.serve_forever() + else: + import mimetypes + mimetypes.init() + mimetypes.add_type('application/json', '.json') + import SimpleHTTPServer + SimpleHTTPServer.test() + |