diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2016-10-23 22:14:46 -0700 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-10-24 06:50:06 -0700 |
commit | 589e71dbc5c9e7fd4bd83c6cbc6d8fab15f134f7 (patch) | |
tree | 126a25bf30a350575ab5a743a67277c40b7ceaef /test | |
parent | 6885797b03526726c76b46d54a9122d41c455ebe (diff) | |
download | ansible-589e71dbc5c9e7fd4bd83c6cbc6d8fab15f134f7.tar.gz |
Fix the uri testserver to run on python3
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/targets/uri/files/testserver.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test/integration/targets/uri/files/testserver.py b/test/integration/targets/uri/files/testserver.py index d0d24a0050..1488c814af 100644 --- a/test/integration/targets/uri/files/testserver.py +++ b/test/integration/targets/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() + |