diff options
author | Quentin Pradet <quentin@clustree.com> | 2016-06-03 15:01:33 +0400 |
---|---|---|
committer | Ask Solem <ask@celeryproject.org> | 2016-06-06 17:56:41 -0700 |
commit | 84348f7ea1a9d134cddedeab9ebc5e59c814e3c8 (patch) | |
tree | 16c976ee4f205b37ad5b0d308bded9a3e1410b8e | |
parent | b12272c54a88ad428a7eaf837280f136b7252e08 (diff) | |
download | py-amqp-84348f7ea1a9d134cddedeab9ebc5e59c814e3c8.tar.gz |
Fix default port
-rw-r--r-- | amqp/tests/test_transport.py | 5 | ||||
-rw-r--r-- | amqp/transport.py | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/amqp/tests/test_transport.py b/amqp/tests/test_transport.py index 6ae7ca4..1a735bc 100644 --- a/amqp/tests/test_transport.py +++ b/amqp/tests/test_transport.py @@ -192,6 +192,11 @@ class test_AbstractTransport(Case): self.t = self.Transport('localhost:5672', 10) self.t.connect() + def test_port(self): + assert self.Transport('localhost').port == 5672 + assert self.Transport('localhost:5672').port == 5672 + assert self.Transport('[fe80::1]:5432').port == 5432 + def test_read(self): with self.assertRaises(NotImplementedError): self.t._read(1024) diff --git a/amqp/transport.py b/amqp/transport.py index 129f40f..088349c 100644 --- a/amqp/transport.py +++ b/amqp/transport.py @@ -66,7 +66,7 @@ TCP_OPTS = [getattr(socket, opt) for opt in KNOWN_TCP_OPTS def to_host_port(host, default=AMQP_PORT): - port = None + port = default m = IPV6_LITERAL.match(host) if m: host = m.group(1) |