diff --git a/qutebrowser/utils/standarddir.py b/qutebrowser/utils/standarddir.py index d934800cc..faf5b178f 100644 --- a/qutebrowser/utils/standarddir.py +++ b/qutebrowser/utils/standarddir.py @@ -39,7 +39,7 @@ def config(): if not overridden: path = _writable_location(typ) appname = QCoreApplication.instance().applicationName() - if path.split(os.sep)[-1] != appname: + if path.split(os.sep)[-1] != appname: # pragma: no branch # WORKAROUND - see # https://bugreports.qt.io/browse/QTBUG-38872 path = os.path.join(path, appname) diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index 3b6d874f3..40392f276 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -112,14 +112,20 @@ class TestStandardDir: ]) @pytest.mark.linux def test_linux_explicit(self, monkeypatch, tmpdir, func, varname): - """Test dirs with XDG_*_HOME explicitly set.""" + """Test dirs with XDG environment variables explicitly set. + + Args: + func: The function to test. + varname: The environment variable which should be set. + """ monkeypatch.setenv(varname, str(tmpdir)) assert func() == str(tmpdir / 'qute_test') @pytest.mark.parametrize('func, subdirs', [ - (standarddir.data, ['.local', 'share']), - (standarddir.config, ['.config']), - (standarddir.cache, ['.cache']), + (standarddir.data, ['.local', 'share', 'qute_test']), + (standarddir.config, ['.config', 'qute_test']), + (standarddir.cache, ['.cache', 'qute_test']), + (standarddir.download, ['Downloads']), ]) @pytest.mark.linux def test_linux_normal(self, monkeypatch, tmpdir, func, subdirs): @@ -127,12 +133,13 @@ class TestStandardDir: monkeypatch.setenv('HOME', str(tmpdir)) for var in ('DATA', 'CONFIG', 'CACHE'): monkeypatch.delenv('XDG_{}_HOME'.format(var), raising=False) - assert func() == str(tmpdir.join(*subdirs) / 'qute_test') + assert func() == str(tmpdir.join(*subdirs)) @pytest.mark.parametrize('func, elems, expected', [ (standarddir.data, 2, ['qute_test', 'data']), (standarddir.config, 1, ['qute_test']), (standarddir.cache, 2, ['qute_test', 'cache']), + (standarddir.download, 1, ['Downloads']), ]) @pytest.mark.windows def test_windows(self, func, elems, expected):