Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 04e74ab

Browse files
committed
allow single arg in append_conf()
1 parent f800bfc commit 04e74ab

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

testgres/node.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,21 +384,22 @@ def get_auth_method(t):
384384

385385
return self
386386

387-
def append_conf(self, filename, string):
387+
@method_decorator(positional_args_hack(['filename', 'line']))
388+
def append_conf(self, line, filename=PG_CONF_FILE):
388389
"""
389-
Append line to a config file (i.e. postgresql.conf).
390+
Append line to a config file.
390391
391392
Args:
392-
filename: name of the config file.
393-
string: string to be appended to config.
393+
line: string to be appended to config.
394+
filename: config file (postgresql.conf by default).
394395
395396
Returns:
396397
This instance of PostgresNode.
397398
"""
398399

399400
config_name = os.path.join(self.data_dir, filename)
400-
with io.open(config_name, "a") as conf:
401-
conf.write(u"".join([string, '\n']))
401+
with io.open(config_name, 'a') as conf:
402+
conf.write(u''.join([line, '\n']))
402403

403404
return self
404405

tests/test_simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def test_reload(self):
171171

172172
# change client_min_messages and save old value
173173
cmm_old = node.execute('show client_min_messages')
174-
node.append_conf('postgresql.conf', 'client_min_messages = DEBUG1')
174+
node.append_conf('client_min_messages = DEBUG1')
175175

176176
# reload config
177177
node.reload()

0 commit comments

Comments
 (0)