Cleanup after unit tests (#3277)

Close https://github.com/patroni/patroni/issues/3276
This commit is contained in:
Alexander Kukushkin
2025-02-14 13:29:34 +01:00
committed by GitHub
parent 0d87270897
commit 6920b3af0e
+5 -1
View File
@@ -252,7 +252,8 @@ class PostgresInit(unittest.TestCase):
@patch.object(ConfigHandler, 'replace_pg_ident', Mock())
@patch.object(Postgresql, 'get_postgres_role_from_data_directory', Mock(return_value='primary'))
def setUp(self):
data_dir = os.path.join('data', 'test0')
self._tmp_dir = 'data'
data_dir = os.path.join(self._tmp_dir, 'test0')
config = {'name': 'postgresql0', 'scope': 'batman', 'data_dir': data_dir,
'config_dir': data_dir, 'retry_timeout': 10,
'krbsrvname': 'postgres', 'pgpass': os.path.join(data_dir, 'pgpass0'),
@@ -293,3 +294,6 @@ class BaseTestPostgresql(PostgresInit):
def tearDown(self):
if os.path.exists(self.p.data_dir):
shutil.rmtree(self.p.data_dir)
if not os.listdir(self._tmp_dir):
shutil.rmtree(self._tmp_dir)