diff options
Diffstat (limited to 'tests/unit/utils/test_standarddir.py')
-rw-r--r-- | tests/unit/utils/test_standarddir.py | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index dcb863d1d..ef1da5a07 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -28,10 +28,10 @@ import textwrap import logging import subprocess -from PyQt5.QtCore import QStandardPaths +from qutebrowser.qt.core import QStandardPaths import pytest -from qutebrowser.utils import standarddir, utils, qtutils, version +from qutebrowser.utils import standarddir, utils, version # Use a different application name for tests to make sure we don't change real @@ -114,8 +114,8 @@ def test_fake_windows(tmpdir, monkeypatch, what): def test_fake_haiku(tmpdir, monkeypatch): """Test getting data dir on HaikuOS.""" locations = { - QStandardPaths.AppDataLocation: '', - QStandardPaths.ConfigLocation: str(tmpdir / 'config' / APPNAME), + QStandardPaths.StandardLocation.AppDataLocation: '', + QStandardPaths.StandardLocation.ConfigLocation: str(tmpdir / 'config' / APPNAME), } monkeypatch.setattr(standarddir.QStandardPaths, 'writableLocation', locations.get) @@ -135,14 +135,14 @@ class TestWritableLocation: 'qutebrowser.utils.standarddir.QStandardPaths.writableLocation', lambda typ: '') with pytest.raises(standarddir.EmptyValueError): - standarddir._writable_location(QStandardPaths.AppDataLocation) + standarddir._writable_location(QStandardPaths.StandardLocation.AppDataLocation) def test_sep(self, monkeypatch): """Make sure the right kind of separator is used.""" monkeypatch.setattr(standarddir.os, 'sep', '\\') monkeypatch.setattr(standarddir.os.path, 'join', lambda *parts: '\\'.join(parts)) - loc = standarddir._writable_location(QStandardPaths.AppDataLocation) + loc = standarddir._writable_location(QStandardPaths.StandardLocation.AppDataLocation) assert '/' not in loc assert '\\' in loc @@ -193,21 +193,6 @@ class TestStandardDir: assert func() == str(tmp_path.joinpath(*subdirs)) @pytest.mark.linux - @pytest.mark.qt_log_ignore(r'^QStandardPaths: ') - @pytest.mark.skipif( - qtutils.version_check('5.14', compiled=False), - reason="Qt 5.14 automatically creates missing runtime dirs") - def test_linux_invalid_runtimedir(self, monkeypatch, tmpdir): - """With invalid XDG_RUNTIME_DIR, fall back to TempLocation.""" - tmpdir_env = tmpdir / 'temp' - tmpdir_env.ensure(dir=True) - monkeypatch.setenv('XDG_RUNTIME_DIR', str(tmpdir / 'does-not-exist')) - monkeypatch.setenv('TMPDIR', str(tmpdir_env)) - - standarddir._init_runtime(args=None) - assert standarddir.runtime() == str(tmpdir_env / APPNAME) - - @pytest.mark.linux @pytest.mark.parametrize('args_basedir', [True, False]) def test_flatpak_runtimedir(self, fake_flatpak, monkeypatch, tmp_path, args_basedir): @@ -471,7 +456,7 @@ def test_no_qapplication(qapp, tmpdir, monkeypatch): sys.path = sys.argv[1:] # make sure we have the same python path - from PyQt5.QtWidgets import QApplication + from qutebrowser.qt.widgets import QApplication from qutebrowser.utils import standarddir assert QApplication.instance() is None |