Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5410118

Browse files
author
Ivan Lazarev
committed
[PBCKP-304] auto tests cleanup added to ptrack_helper.py
1 parent 383a1a8 commit 5410118

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

‎tests/cfs_backup.py‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import shutil
55

66
from .helpers.cfs_helpers import find_by_extensions, find_by_name, find_by_pattern, corrupt_file
7-
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, is_test_result_ok
7+
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
88

99
tblspace_name = 'cfs_tblspace'
1010

@@ -1160,15 +1160,9 @@ def test_broken_file_pg_compression_into_tablespace_dir(self):
11601160
)
11611161

11621162
# # --- End ---#
1163-
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
1164-
def tearDown(self):
1165-
module_name = self.id().split('.')[1]
1166-
fname = self.id().split('.')[3]
1167-
if is_test_result_ok(self):
1168-
self.del_test_dir(module_name, fname)
11691163

11701164

1171-
#class CfsBackupEncTest(CfsBackupNoEncTest):
1165+
#class CfsBackupEncTest(CfsBackupNoEncTest):
11721166
# # --- Begin --- #
11731167
# def setUp(self):
11741168
# os.environ["PG_CIPHER_KEY"] = "super_secret_cipher_key"

‎tests/cfs_restore.py‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import shutil
1414

1515
from .helpers.cfs_helpers import find_by_name
16-
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, is_test_result_ok
16+
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
1717

1818
tblspace_name = 'cfs_tblspace'
1919
tblspace_name_new = 'cfs_tblspace_new'
@@ -59,13 +59,6 @@ def setUp(self):
5959
def add_data_in_cluster(self):
6060
pass
6161

62-
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
63-
def tearDown(self):
64-
module_name = self.id().split('.')[1]
65-
fname = self.id().split('.')[3]
66-
if is_test_result_ok(self):
67-
self.del_test_dir(module_name, fname)
68-
6962

7063
class CfsRestoreNoencEmptyTablespaceTest(CfsRestoreBase):
7164
# @unittest.expectedFailure

‎tests/helpers/ptrack_helpers.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,16 @@ class ProbackupTest(object):
201201
# Class attributes
202202
enterprise = is_enterprise()
203203
enable_nls = is_nls_enabled()
204+
module_name = None
205+
fname = None
204206

205207
def __init__(self, *args, **kwargs):
206208
super(ProbackupTest, self).__init__(*args, **kwargs)
209+
210+
if isinstance(self, unittest.TestCase):
211+
self.module_name = self.id().split('.')[1]
212+
self.fname = self.id().split('.')[3]
213+
207214
if '-v' in argv or '--verbose' in argv:
208215
self.verbose = True
209216
else:
@@ -367,6 +374,13 @@ def __init__(self, *args, **kwargs):
367374

368375
os.environ["PGAPPNAME"] = "pg_probackup"
369376

377+
def tearDown(self):
378+
if isinstance(self, unittest.TestCase):
379+
module_name = self.id().split('.')[1]
380+
fname = self.id().split('.')[3]
381+
if is_test_result_ok(self):
382+
self.del_test_dir(module_name, fname)
383+
370384
@property
371385
def pg_config_version(self):
372386
return self.version_to_num(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /