From 9bf88649a3c45138e04af6083082b4c808ae9f00 Mon Sep 17 00:00:00 2001 From: "Fabien C. Y. Benureau" Date: Sat, 5 Jan 2019 01:06:44 +0900 Subject: [PATCH] fix #172 --- pubs/commands/conf_cmd.py | 4 ++-- tests/test_usecase.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pubs/commands/conf_cmd.py b/pubs/commands/conf_cmd.py index cd3e9e0..69f8677 100644 --- a/pubs/commands/conf_cmd.py +++ b/pubs/commands/conf_cmd.py @@ -17,9 +17,9 @@ def command(conf, args): while True: # get modif from user - ui.edit_file(config.get_confpath(), temporary=False) + ui.edit_file(conf.filename, temporary=False) - new_conf = config.load_conf() + new_conf = config.load_conf(path=conf.filename) try: config.check_conf(new_conf) ui.message('The configuration file was updated.') diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 38dc8ca..80edea7 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -985,7 +985,7 @@ class TestUsecase(DataCommandTestCase): alt_conf = os.path.expanduser('~/.alt_conf') cmds = ['pubs -c ' + alt_conf + ' init', 'pubs --config ' + alt_conf + ' import data/ Page99', - 'pubs list -c ' + alt_conf + 'pubs list -c ' + alt_conf, ] outs = self.execute_cmds(cmds) # check if pubs works as expected @@ -994,6 +994,11 @@ class TestUsecase(DataCommandTestCase): self.assertFalse(os.path.isfile(self.default_conf_path)) self.assertTrue(os.path.isfile(alt_conf)) + with open(alt_conf, 'r') as fd: + conf_text = fd.read() + outs = self.execute_cmds([('pubs conf -c ' + alt_conf, conf_text)]) + + def test_statistics(self): cmds = ['pubs init', 'pubs statistics',