Skip to content

Commit e27f01b

Browse files
committedMar 14, 2018
minor fixes to ProcessProxy
1 parent c86c0bf commit e27f01b

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed
 

‎testgres/node.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ def __init__(self, process):
8080
def __getattr__(self, name):
8181
return getattr(self.process, name)
8282

83-
def __str__(self):
84-
pid = self.process.pid
85-
cmdline = ' '.join(self.process.cmdline()).strip()
86-
return '{} [{}]'.format(cmdline, pid)
83+
def __repr__(self):
84+
return '{} : {}'.format(str(self.ptype), repr(self.process))
8785

8886

8987
class PostgresNode(object):
@@ -219,7 +217,8 @@ def source_walsender(self):
219217
if child.pid == int(row[0]):
220218
return child
221219

222-
raise QueryException("Master doesn't send WAL to {}", self.name)
220+
msg = "Master doesn't send WAL to {}".format(self.name)
221+
raise TestgresException(msg)
223222

224223
@property
225224
def master(self):
@@ -968,7 +967,7 @@ def catchup(self, dbname=None, username=None):
968967
"""
969968

970969
if not self.master:
971-
raise CatchUpException("Node doesn't have a master")
970+
raise TestgresException("Node doesn't have a master")
972971

973972
if pg_version_ge('10'):
974973
poll_lsn = "select pg_current_wal_lsn()::text"

‎tests/test_simple.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
ExecUtilException, \
2121
BackupException, \
2222
QueryException, \
23-
CatchUpException, \
2423
TimeoutException, \
2524
TestgresException
2625

@@ -397,7 +396,7 @@ def test_incorrect_catchup(self):
397396
node.init(allow_streaming=True).start()
398397

399398
# node has no master, can't catch up
400-
with self.assertRaises(CatchUpException):
399+
with self.assertRaises(TestgresException):
401400
node.catchup()
402401

403402
def test_dump(self):
@@ -759,7 +758,7 @@ def test_child_pids(self):
759758
replica.stop()
760759

761760
# there should be no walsender after we've stopped replica
762-
with self.assertRaises(QueryException):
761+
with self.assertRaises(TestgresException):
763762
replica.source_walsender
764763

765764

0 commit comments

Comments
 (0)
Please sign in to comment.