def do_waiting(): # Wait on the free port that's unbound servers.wait_for_occupied_port('0.0.0.0', free_port) # The wait should still raise an IO error if INADDR_ANY was # not supplied. self.assertRaises(IOError, servers.wait_for_occupied_port, '127.0.0.1', free_port)
def do_waiting(): # Wait on the free port that's unbound with warnings.catch_warnings(record=True) as w: servers.wait_for_occupied_port("0.0.0.0", free_port) self.assertEqual(len(w), 1) self.assertTrue(isinstance(w[0], warnings.WarningMessage)) self.assertTrue("Unable to verify that the server is bound on " in str(w[0])) # The wait should still raise an IO error if INADDR_ANY was # not supplied. self.assertRaises(IOError, servers.wait_for_occupied_port, "127.0.0.1", free_port)
def do_waiting(): # Wait on the free port that's unbound with warnings.catch_warnings(record=True) as w: servers.wait_for_occupied_port('0.0.0.0', free_port) self.assertEqual(len(w), 1) self.assertTrue(isinstance(w[0], warnings.WarningMessage)) self.assertTrue( 'Unable to verify that the server is bound on ' in str(w[0])) # The wait should still raise an IO error if INADDR_ANY was # not supplied. self.assertRaises(IOError, servers.wait_for_occupied_port, '127.0.0.1', free_port)