Skip to content

Commit

Permalink
Change connection-refused test from localhost to 127.0.0.1.
Browse files Browse the repository at this point in the history
This might be contributing to occasional timeouts on travis-ci
(on the theory that some other test may be listening on the
same port on ::1).

Also explicitly stop the test if connect_callback is called.
  • Loading branch information
bdarnell committed Oct 18, 2014
1 parent e2e35db commit e1b306c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tornado/test/iostream_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,11 @@ def test_connection_refused(self):

def connect_callback():
self.connect_called = True
self.stop()
stream.set_close_callback(self.stop)
# log messages vary by platform and ioloop implementation
with ExpectLog(gen_log, ".*", required=False):
stream.connect(("localhost", port), connect_callback)
stream.connect(("127.0.0.1", port), connect_callback)
self.wait()
self.assertFalse(self.connect_called)
self.assertTrue(isinstance(stream.error, socket.error), stream.error)
Expand Down

0 comments on commit e1b306c

Please sign in to comment.