File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -805,6 +805,9 @@ def test_ConfigDBConnector():
805
805
806
806
807
807
def test_ConfigDBConnector_with_statement ():
808
+ gc .collect ()
809
+ last_connector_count = sum (isinstance (x , swsscommon .ConfigDBConnector ) for x in gc .get_objects ())
810
+
808
811
# test ConfigDBConnector support 'with' statement
809
812
with swsscommon .ConfigDBConnector () as config_db :
810
813
assert config_db .db_name == ""
@@ -816,3 +819,9 @@ def test_ConfigDBConnector_with_statement():
816
819
config_db .set_entry ("TEST_PORT" , "Ethernet111" , {"alias" : "etp1x" })
817
820
allconfig = config_db .get_config ()
818
821
assert allconfig ["TEST_PORT" ]["Ethernet111" ]["alias" ] == "etp1x"
822
+
823
+
824
+ # check ConfigDBConnector will release after 'with' statement
825
+ gc .collect ()
826
+ current_connector_count = sum (isinstance (x , swsscommon .ConfigDBConnector ) for x in gc .get_objects ())
827
+ assert current_connector_count == last_connector_count
You can’t perform that action at this time.
0 commit comments