blob: fefb9b80d3db6769d4d8a25f2587c697e1c6f97a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
https://github.com/blampe/Testify/commit/c1e159fe0e668a1ee56b0b1b2858c0a0becf20a0
https://github.com/Yelp/Testify/issues/65
--- a/test/plugins/http_reporter_test.py
+++ b/test/plugins/http_reporter_test.py
@@ -39,7 +39,7 @@
app = tornado.web.Application([(r"/results", ResultsHandler)])
srv = tornado.httpserver.HTTPServer(app)
srv.listen(0)
- portnum = srv._socket.getsockname()[1]
+ portnum = self.get_port_number(srv)
iol = tornado.ioloop.IOLoop.instance()
thread = threading.Thread(target=iol.start)
@@ -53,6 +53,14 @@
iol.stop()
thread.join()
+ def get_port_number(self, server):
+
+ if hasattr(server, "_sockets"): # tornado > 2.0
+ _socket = server._sockets.values()[0]
+ else: # tornado 1.2 or earlier
+ _socket = server._socket
+ return _socket.getsockname()[1]
+
def test_http_reporter_reports(self):
"""A simple test to make sure the HTTPReporter actually reports things."""
|