diff --git a/diceware/config.py b/diceware/config.py index 60d245434f01c0c0c8d0efbc3be49b1e6aa84fda..0a50456f356a46d57c537da9e29ed0a8ad1d3eb1 100644 --- a/diceware/config.py +++ b/diceware/config.py @@ -49,10 +49,12 @@ def valid_locations(): def get_configparser(path_list=None): """Parse `path_list` for config values. + If no list is given we use `valid_locations()`. + Return a list of paths read and a config parser instance. """ if path_list is None: - path_list = [] + path_list = valid_locations() parser = configparser.SafeConfigParser() found = parser.read(path_list) return found, parser diff --git a/tests/test_config.py b/tests/test_config.py index 2a5f4b3937447b8b7a04b640c82d9e66601484a0..0034c54de625843b8850beddc17db9f8a814336e 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -31,7 +31,10 @@ class TestConfigModule(object): found, config = get_configparser([]) assert found == [] - def test_get_configparser_no_list(self): + def test_get_configparser_no_list(self, tmpdir, monkeypatch): # we cope with no list at all + new_home = tmpdir / "home" + new_home.ensure_dir() + monkeypatch.setenv("HOME", str(new_home)) found, config = get_configparser() assert found == []