File tree Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change 11# you need os for unittest to work
22import os
3+ import gc
34from sys import exit , argv , version_info
45import subprocess
56import shutil
@@ -1515,29 +1516,24 @@ def get_version(self, node):
15151516 def get_bin_path (self , binary ):
15161517 return testgres .get_bin_path (binary )
15171518
1519+ def clean_all (self ):
1520+ for o in gc .get_referrers (testgres .PostgresNode ):
1521+ if o .__class__ is testgres .PostgresNode :
1522+ o .cleanup ()
1523+
15181524 def del_test_dir (self , module_name , fname , nodes = []):
15191525 """ Del testdir and optimistically try to del module dir"""
15201526 try :
1521- testgres .clean_all ()
1522- except :
1523- pass
1524-
1525- if not nodes :
1526- nodes = self .nodes
1527- for node in list (nodes ):
1528- try :
1529- if node .status () == 0 :
1530- node .stop ()
1531- except :
1532- raise
1533- finally :
1534- if node in self .nodes :
1535- self .nodes .remove (node )
1527+ self .clean_all ()
1528+ except Exception as e :
1529+ raise e
15361530
15371531 shutil .rmtree (
15381532 os .path .join (
15391533 self .tmp_path ,
1540- module_name
1534+ module_name ,
1535+ fname ,
1536+ "backup"
15411537 ),
15421538 ignore_errors = True
15431539 )
You can’t perform that action at this time.
0 commit comments