Exemple #1
0
    def test_port_can_be_bound_already_bound(self):
        tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        try:
            tcp.bind(("", 0))
            addr, port = tcp.getsockname()
            assert not common.port_can_be_bound(port)
        finally:
            tcp.close()

        assert common.port_can_be_bound(port)
Exemple #2
0
 def test_port_can_be_bound_illegal_port(self):
     assert not common.port_can_be_bound(9999999999)
Exemple #3
0
 def test_port_can_be_bound_illegal_port(self):
     self.assertFalse(common.port_can_be_bound(9999999999))
Exemple #4
0
 def test_port_can_be_bound(self):
     port = common.get_free_tcp_port()
     assert common.port_can_be_bound(port)
Exemple #5
0
 def test_port_can_be_bound(self):
     port = common.get_free_tcp_port()
     self.assertTrue(common.port_can_be_bound(port))