@@ -918,20 +918,38 @@ def test_isolation_levels(self):
918
918
con .begin ('Garbage' ).commit ()
919
919
920
920
def test_ports_management (self ):
921
- # check that no ports have been bound yet
922
- assert (len (bound_ports ) == 0 )
921
+ assert bound_ports is not None
922
+ assert type (bound_ports ) == set # noqa: E721
923
+
924
+ if len (bound_ports ) != 0 :
925
+ logging .warning ("bound_ports is not empty: {0}" .format (bound_ports ))
926
+
927
+ stage0__bound_ports = bound_ports .copy ()
923
928
924
929
with get_new_node () as node :
925
- # check that we've just bound a port
926
- assert (len (bound_ports ) == 1 )
930
+ assert bound_ports is not None
931
+ assert type (bound_ports ) == set # noqa: E721
932
+
933
+ assert node .port is not None
934
+ assert type (node .port ) == int # noqa: E721
935
+
936
+ logging .info ("node port is {0}" .format (node .port ))
937
+
938
+ assert node .port in bound_ports
939
+ assert node .port not in stage0__bound_ports
940
+
941
+ assert stage0__bound_ports <= bound_ports
942
+ assert len (stage0__bound_ports ) + 1 == len (bound_ports )
943
+
944
+ stage1__bound_ports = stage0__bound_ports .copy ()
945
+ stage1__bound_ports .add (node .port )
927
946
928
- # check that bound_ports contains our port
929
- port_1 = list (bound_ports )[0 ]
930
- port_2 = node .port
931
- assert (port_1 == port_2 )
947
+ assert stage1__bound_ports == bound_ports
932
948
933
949
# check that port has been freed successfully
934
- assert (len (bound_ports ) == 0 )
950
+ assert bound_ports is not None
951
+ assert type (bound_ports ) == set # noqa: E721
952
+ assert bound_ports == stage0__bound_ports
935
953
936
954
def test_exceptions (self ):
937
955
str (StartNodeException ('msg' , [('file' , 'lines' )]))
0 commit comments