@@ -139,49 +139,44 @@ def __init__(self, message, cmd):
139
139
def __str__ (self ):
140
140
return '\n ERROR: {0}\n CMD: {1}' .format (repr (self .message ), self .cmd )
141
141
142
-
143
- def _slow_start (self , replica = False ):
144
-
145
- # wait for https://github.com/postgrespro/testgres/pull/50
146
- # self.start()
147
- # self.poll_query_until(
148
- # "postgres",
149
- # "SELECT not pg_is_in_recovery()",
150
- # suppress={testgres.NodeConnection})
151
- if replica :
152
- query = 'SELECT pg_is_in_recovery()'
153
- else :
154
- query = 'SELECT not pg_is_in_recovery()'
155
-
156
- self .start ()
157
- while True :
158
- try :
159
- output = self .safe_psql ('template1' , query ).decode ("utf-8" ).rstrip ()
160
-
161
- if output == 't' :
162
- break
163
-
164
- except testgres .QueryException as e :
165
- if 'database system is starting up' in e .message :
166
- pass
167
- elif 'FATAL: the database system is not accepting connections' in e .message :
168
- pass
169
- elif replica and 'Hot standby mode is disabled' in e .message :
170
- raise e
171
- else :
172
- raise e
173
-
174
- sleep (0.5 )
175
-
176
-
177
142
class PostgresNodeExtended (testgres .PostgresNode ):
178
143
179
144
def __init__ (self , base_dir = None , * args , ** kwargs ):
180
145
super (PostgresNodeExtended , self ).__init__ (name = 'test' , base_dir = base_dir , * args , ** kwargs )
181
146
self .is_started = False
182
147
183
148
def slow_start (self , replica = False ):
184
- _slow_start (self , replica = replica )
149
+
150
+ # wait for https://github.com/postgrespro/testgres/pull/50
151
+ # self.start()
152
+ # self.poll_query_until(
153
+ # "postgres",
154
+ # "SELECT not pg_is_in_recovery()",
155
+ # suppress={testgres.NodeConnection})
156
+ if replica :
157
+ query = 'SELECT pg_is_in_recovery()'
158
+ else :
159
+ query = 'SELECT not pg_is_in_recovery()'
160
+
161
+ self .start ()
162
+ while True :
163
+ try :
164
+ output = self .safe_psql ('template1' , query ).decode ("utf-8" ).rstrip ()
165
+
166
+ if output == 't' :
167
+ break
168
+
169
+ except testgres .QueryException as e :
170
+ if 'database system is starting up' in e .message :
171
+ pass
172
+ elif 'FATAL: the database system is not accepting connections' in e .message :
173
+ pass
174
+ elif replica and 'Hot standby mode is disabled' in e .message :
175
+ raise e
176
+ else :
177
+ raise e
178
+
179
+ sleep (0.5 )
185
180
186
181
def start (self , * args , ** kwargs ):
187
182
if not self .is_started :
@@ -370,7 +365,7 @@ def __init__(self, *args, **kwargs):
370
365
371
366
os .environ ["PGAPPNAME" ] = "pg_probackup"
372
367
373
- def __is_test_result_ok (test_case ):
368
+ def is_test_result_ok (test_case ):
374
369
# sources of solution:
375
370
# 1. python versions 2.7 - 3.10, verified on 3.10, 3.7, 2.7, taken from:
376
371
# https://tousu.in/qa/?qa=555402/unit-testing-getting-pythons-unittest-results-in-a-teardown-method&show=555403#a555403
@@ -396,7 +391,7 @@ def __is_test_result_ok(test_case):
396
391
return ok
397
392
398
393
def tearDown (self ):
399
- if self .__is_test_result_ok ():
394
+ if self .is_test_result_ok ():
400
395
for node in self .nodes_to_cleanup :
401
396
node .cleanup ()
402
397
self .del_test_dir (self .module_name , self .fname )
0 commit comments