Movatterモバイル変換


[0]ホーム

URL:


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

Commit0784f49

Browse files
author
vshepard
committed
Normalize error
1 parent9f69b30 commit0784f49

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

‎testgres/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,6 @@ def poll_query_until(self,
11651165
assertsleep_time>0
11661166
attempts=0
11671167
whilemax_attempts==0orattempts<max_attempts:
1168-
logging.info(f"Pooling{attempts}")
11691168
try:
11701169
res=self.execute(dbname=dbname,
11711170
query=query,
@@ -1189,6 +1188,7 @@ def poll_query_until(self,
11891188
return# done
11901189

11911190
excepttuple(suppressor []):
1191+
logging.info(f"Trying execute, attempt{attempts+1}.\nQuery:{query}")
11921192
pass# we're suppressing them
11931193

11941194
time.sleep(sleep_time)

‎testgres/operations/remote_ops.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
9393
ifnoterror:
9494
error_found=0
9595
else:
96+
error=normalize_error(error)
9697
error_found=exit_status!=0orany(
97-
markerinerrorformarkerin [b'error',b'Permission denied',b'fatal',b'No such file or directory'])
98+
markerinerrorformarkerin ['error','Permission denied','fatal','No such file or directory']
99+
)
98100

99101
iferror_found:
100102
ifisinstance(error,bytes):
@@ -369,3 +371,9 @@ def db_connect(self, dbname, user, password=None, host="localhost", port=5432):
369371
password=password,
370372
)
371373
returnconn
374+
375+
376+
defnormalize_error(error):
377+
ifisinstance(error,bytes):
378+
returnerror.decode()
379+
returnerror

‎testgres/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__importdivision
44
from __future__importprint_function
55

6-
importlogging
76
importos
87

98
importsys
@@ -229,7 +228,7 @@ def eprint(*args, **kwargs):
229228
"""
230229
Print stuff to stderr.
231230
"""
232-
logging.error(*args,**kwargs)
231+
print(*args,file=sys.stderr,**kwargs)
233232

234233

235234
defoptions_string(separator=u" ",**kwargs):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp