Skip to content

Commit c5602f1

Browse files
author
James William Pye
committed
Merge commit 'v0.8.0'; branch 'v0.8'
2 parents 5131296 + 889392e commit c5602f1

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

postgresql/cluster.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,15 @@ def running(self):
386386
"""
387387
if self.daemon_process is not None:
388388
r = self.daemon_process.poll()
389-
return r is None
389+
if r is not None:
390+
pid = self.get_pid_from_file()
391+
if pid is not None:
392+
# daemon process does not exist, but there's a pidfile.
393+
self.daemon_process = None
394+
return self.running()
395+
return False
396+
else:
397+
return True
390398
else:
391399
pid = self.get_pid_from_file()
392400
if pid is None:

postgresql/documentation/driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@
332332
``db.execute(sql_statements_string)``
333333
Run a block of SQL on the server. This method returns `None` unless an error
334334
occurs. If errors occur, the processing of the statements will stop and the
335-
the error will be raised.
335+
error will be raised.
336336
337337
``db.xact(gid = None, isolation = None, mode = None)``
338338
The `postgresql.api.Transaction` constructor for creating transactions.

postgresql/test/test_cluster.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,23 @@ def tearDown(self):
2525

2626
def start_cluster(self):
2727
self.cluster.start(logfile = None)
28-
self.cluster.wait_until_started(timeout = 30)
28+
self.cluster.wait_until_started(timeout = 10)
2929

3030
def init(self, *args, **kw):
3131
self.cluster.init(*args, **kw)
3232
self.cluster.settings.update({
3333
'max_connections' : '8',
3434
'listen_addresses' : 'localhost',
35-
'port' : '6543'
35+
'port' : '6543',
36+
'silent_mode' : 'off',
3637
})
3738

39+
def testSilentMode(self):
40+
self.init(logfile = None)
41+
self.cluster.settings['silent_mode'] = 'on'
42+
# if it fails to start(ClusterError), silent_mode is not working properly.
43+
self.start_cluster()
44+
3845
def testSuperPassword(self):
3946
self.init(
4047
user = 'test',

postgresql/unittest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def configure_cluster(self):
5454
listen_addresses = 'localhost',
5555
log_destination = 'stderr',
5656
log_min_messages = 'FATAL',
57+
silent_mode = 'off',
5758
))
5859

5960
def initialize_database(self):

0 commit comments

Comments
 (0)