瀏覽代碼

Fix broken tests

Oz Tiram 7 年之前
父節點
當前提交
fd50e0d704
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 3 2
      pwman/util/config.py
  2. 2 2
      tests/test_config.py

+ 3 - 2
pwman/util/config.py

@@ -76,9 +76,10 @@ def find_config_dir(appname):
     config_dir = os.path.expanduser("~/.%s" % appname)
 
     if os.path.exists(config_dir):
-        return config_dir
+        return config_dir, config_dir
     elif platform.system() == 'Windows':
-        return os.path.expandvars(os.path.join('$APPDATA', appname))
+        app_data = os.path.expandvars(os.path.join('$APPDATA', appname))
+        return app_data, app_data
     else:
         return (os.path.join(XDG_CONFIG_HOME, appname),
                 os.path.join(XDG_DATA_HOME, appname))

+ 2 - 2
tests/test_config.py

@@ -102,13 +102,13 @@ class TestConfig(unittest.TestCase):
         self.assertTrue(self.conf.parser.has_section('Readline'))
 
     def test_has_user_history(self):
-        cdir = find_config_dir('pwman')
+        cdir = find_config_dir('pwman')[0]
         path = os.path.join(cdir, "history")
         config = self.conf.get_value('Readline', 'history')
         self.assertEqual(path, config)
 
     def test_has_user_db(self):
-        self.assertNotEqual(os.path.join(config.find_config_dir("pwman"),'pwman.db'),
+        self.assertNotEqual(os.path.join(config.find_config_dir("pwman")[1],'pwman.db'),
                             self.conf.get_value('Database', 'filename'))
 
     def test_wrong_config(self):