diff options
author | Christopher Baines <mail@cbaines.net> | 2015-12-22 14:29:01 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2015-12-22 15:21:33 +0000 |
commit | 1b577142b7b3d006bfb3a3c0fc7ca900332c6523 (patch) | |
tree | 2eae884d18037e36856895e9fc1b1e95c87f6681 /debian | |
parent | 1a6fe6bde5ecdf37b0278033772274dc503ec230 (diff) | |
download | python-urllib3-1b577142b7b3d006bfb3a3c0fc7ca900332c6523.tar python-urllib3-1b577142b7b3d006bfb3a3c0fc7ca900332c6523.tar.gz |
Add DEP8 tests
This is a patch from Edward Betts <edward@4angle.com> (#796717). I then
adjusted the test to work under python3 and added some additional packages to
the Depends for the tests.
Diffstat (limited to 'debian')
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | debian/tests/control | 7 | ||||
-rwxr-xr-x | debian/tests/single_request_py2 | 29 | ||||
-rwxr-xr-x | debian/tests/single_request_py3 | 29 |
4 files changed, 66 insertions, 0 deletions
diff --git a/debian/control b/debian/control index a57c01b..bd65874 100644 --- a/debian/control +++ b/debian/control @@ -27,6 +27,7 @@ X-Python3-Version: >= 3.0 Homepage: http://urllib3.readthedocs.org Vcs-Git: git://anonscm.debian.org/python-modules/packages/python-urllib3.git Vcs-Browser: https://anonscm.debian.org/cgit/python-modules/packages/python-urllib3.git +Testsuite: autopkgtest Package: python-urllib3 Architecture: all diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..fbf7a40 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,7 @@ +Tests: single_request_py2 +Restrictions: isolation-container +Depends: @, python-requests, python-future + +Tests: single_request_py3 +Restrictions: isolation-container +Depends: @, python3-requests, python3-future diff --git a/debian/tests/single_request_py2 b/debian/tests/single_request_py2 new file mode 100755 index 0000000..6f2b604 --- /dev/null +++ b/debian/tests/single_request_py2 @@ -0,0 +1,29 @@ +#!/usr/bin/python2.7 + +from multiprocessing import Process, Pipe +import BaseHTTPServer +import requests + +class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header("Content-type", 'text/plain') + self.end_headers() + self.wfile.write('test') + + def log_request(self, code='-', size='-'): + pass + +def start_server(pipe): + # start a simple server on any available port + httpd = BaseHTTPServer.HTTPServer(('', 0), RequestHandler) + pipe.send(httpd.socket.getsockname()) + httpd.handle_request() + +if __name__ == '__main__': + parent, child = Pipe() + p = Process(target=start_server, args=(child,)) + p.daemon = True + p.start() + # use the socket address from the test server + requests.get('http://{}:{}'.format(*parent.recv())) diff --git a/debian/tests/single_request_py3 b/debian/tests/single_request_py3 new file mode 100755 index 0000000..f15dbb5 --- /dev/null +++ b/debian/tests/single_request_py3 @@ -0,0 +1,29 @@ +#!/usr/bin/python3 + +from multiprocessing import Process, Pipe +from http.server import HTTPServer, BaseHTTPRequestHandler +import requests + +class RequestHandler(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header("Content-type", 'text/plain') + self.end_headers() + self.wfile.write(b'test') + + def log_request(self, code='-', size='-'): + pass + +def start_server(pipe): + # start a simple server on any available port + httpd = HTTPServer(('', 0), RequestHandler) + pipe.send(httpd.socket.getsockname()) + httpd.handle_request() + +if __name__ == '__main__': + parent, child = Pipe() + p = Process(target=start_server, args=(child,)) + p.daemon = True + p.start() + # use the socket address from the test server + requests.get('http://{}:{}'.format(*parent.recv())) |