def testMakeServerBlankHost(self): # Test that we can bind to all interfaces without throwing an error server, url = tensorboard.make_simple_server( self._StubApplication(), host='', port=0) # Grab any available port self.assertTrue(server) self.assertTrue(url)
def testSpecifiedHost(self): one_passed = False try: _, url = tensorboard.make_simple_server( self._StubApplication(), host='127.0.0.1', port=0) self.assertStartsWith(actual=url, expected_start='http://127.0.0.1:') one_passed = True except socket.error: # IPv4 is not supported pass try: _, url = tensorboard.make_simple_server( self._StubApplication(), host='::1', port=0) self.assertStartsWith(actual=url, expected_start='http://[::1]:') one_passed = True except socket.error: # IPv6 is not supported pass self.assertTrue(one_passed) # We expect either IPv4 or IPv6 to be supported