This commit is contained in:
Yura Sokolov
2022-11-16 16:14:32 +03:00
parent 516d325a11
commit 4c823b3930
+8 -13
View File
@@ -139,8 +139,13 @@ class ProbackupException(Exception):
def __str__(self):
return '\n ERROR: {0}\n CMD: {1}'.format(repr(self.message), self.cmd)
class PostgresNodeExtended(testgres.PostgresNode):
def _slow_start(self, replica=False):
def __init__(self, base_dir=None, *args, **kwargs):
super(PostgresNodeExtended, self).__init__(name='test', base_dir=base_dir, *args, **kwargs)
self.is_started = False
def slow_start(self, replica=False):
# wait for https://github.com/postgrespro/testgres/pull/50
# self.start()
@@ -173,16 +178,6 @@ def _slow_start(self, replica=False):
sleep(0.5)
class PostgresNodeExtended(testgres.PostgresNode):
def __init__(self, base_dir=None, *args, **kwargs):
super(PostgresNodeExtended, self).__init__(name='test', base_dir=base_dir, *args, **kwargs)
self.is_started = False
def slow_start(self, replica=False):
_slow_start(self, replica=replica)
def start(self, *args, **kwargs):
if not self.is_started:
super(PostgresNodeExtended, self).start(*args, **kwargs)
@@ -370,7 +365,7 @@ class ProbackupTest(object):
os.environ["PGAPPNAME"] = "pg_probackup"
def __is_test_result_ok(test_case):
def is_test_result_ok(test_case):
# sources of solution:
# 1. python versions 2.7 - 3.10, verified on 3.10, 3.7, 2.7, taken from:
# https://tousu.in/qa/?qa=555402/unit-testing-getting-pythons-unittest-results-in-a-teardown-method&show=555403#a555403
@@ -396,7 +391,7 @@ class ProbackupTest(object):
return ok
def tearDown(self):
if self.__is_test_result_ok():
if self.is_test_result_ok():
for node in self.nodes_to_cleanup:
node.cleanup()
self.del_test_dir(self.module_name, self.fname)