fix standarddir tests
This commit is contained in:
parent
05943b2538
commit
3a6ae695cf
|
|
@ -38,7 +38,7 @@ class _Location(enum.Enum):
|
|||
|
||||
|
||||
APPNAME = 'qutebrowser'
|
||||
CONFIG_LOCATIONS = [os.path.join(os.path.normpath(os.getenv('XDG_CONFIG_HOME', '~/.config')), APPNAME), '~/.' + APPNAME]
|
||||
CONFIG_LOCATIONS = [os.path.normpath(os.getenv('XDG_CONFIG_HOME', '~/.config')) + '/', '~/.']
|
||||
|
||||
|
||||
class EmptyValueError(Exception):
|
||||
|
|
@ -100,8 +100,9 @@ def _get_config_location() -> str:
|
|||
Searches CONFIG_LOCATIONS in order for existing config folder, defaults to
|
||||
CONFIG_LOCATIONS[0]
|
||||
"""
|
||||
it = (p for p in CONFIG_LOCATIONS if p is not None and os.path.exists(os.path.expanduser(p)))
|
||||
path = next(it, CONFIG_LOCATIONS[0])
|
||||
it = (p + APPNAME for p in CONFIG_LOCATIONS if
|
||||
os.path.exists(os.path.expanduser(p + APPNAME)))
|
||||
path = next(it, CONFIG_LOCATIONS[0] + APPNAME)
|
||||
return os.path.expanduser(path)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ def test_unset_organization_no_qapp(monkeypatch):
|
|||
@pytest.mark.posix
|
||||
def test_fake_mac_config(tmp_path, fake_home_envvar):
|
||||
"""Test standardir.config on a fake Mac."""
|
||||
expected = str(tmp_path) + '/.qute_test' # always with /
|
||||
expected = str(tmp_path) + '/.config/qute_testii' # always with /
|
||||
standarddir._init_config(args=None)
|
||||
assert standarddir.config() == expected
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ class TestStandardDir:
|
|||
(standarddir.data, 2, ['Application Support', APPNAME]),
|
||||
(lambda: standarddir.config(auto=True), 1, [APPNAME]),
|
||||
(standarddir.config, 0,
|
||||
os.path.expanduser('~').split(os.sep) + ['.qute_test']),
|
||||
os.path.expanduser('~').split(os.sep) + ['.config'] + ['qute_test']),
|
||||
(standarddir.cache, 2, ['Caches', APPNAME]),
|
||||
(standarddir.download, 1, ['Downloads']),
|
||||
])
|
||||
|
|
|
|||
Loading…
Reference in New Issue