Skip to content

Commit 3cc1627

Browse files
TestgresRemoteTests::test_ports_management is corrected (#198)
It is synchronized with TestgresTests::test_ports_management.
1 parent 6d67da2 commit 3cc1627

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

tests/test_simple_remote.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -976,20 +976,38 @@ def test_isolation_levels(self):
976976
con.begin('Garbage').commit()
977977

978978
def test_ports_management(self):
979-
# check that no ports have been bound yet
980-
assert (len(bound_ports) == 0)
979+
assert bound_ports is not None
980+
assert type(bound_ports) == set # noqa: E721
981+
982+
if len(bound_ports) != 0:
983+
logging.warning("bound_ports is not empty: {0}".format(bound_ports))
984+
985+
stage0__bound_ports = bound_ports.copy()
981986

982987
with __class__.helper__get_node() as node:
983-
# check that we've just bound a port
984-
assert (len(bound_ports) == 1)
988+
assert bound_ports is not None
989+
assert type(bound_ports) == set # noqa: E721
990+
991+
assert node.port is not None
992+
assert type(node.port) == int # noqa: E721
993+
994+
logging.info("node port is {0}".format(node.port))
995+
996+
assert node.port in bound_ports
997+
assert node.port not in stage0__bound_ports
998+
999+
assert stage0__bound_ports <= bound_ports
1000+
assert len(stage0__bound_ports) + 1 == len(bound_ports)
1001+
1002+
stage1__bound_ports = stage0__bound_ports.copy()
1003+
stage1__bound_ports.add(node.port)
9851004

986-
# check that bound_ports contains our port
987-
port_1 = list(bound_ports)[0]
988-
port_2 = node.port
989-
assert (port_1 == port_2)
1005+
assert stage1__bound_ports == bound_ports
9901006

9911007
# check that port has been freed successfully
992-
assert (len(bound_ports) == 0)
1008+
assert bound_ports is not None
1009+
assert type(bound_ports) == set # noqa: E721
1010+
assert bound_ports == stage0__bound_ports
9931011

9941012
def test_exceptions(self):
9951013
str(StartNodeException('msg', [('file', 'lines')]))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy