From 3c26abd09a93856dc34e5ed2ea36f38cb76abc1b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 31 Mar 2022 15:04:09 +0200 Subject: Test system-data dir with flatpak --- tests/unit/utils/test_standarddir.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index e05b5d31f..f5d8204a4 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -31,7 +31,7 @@ import subprocess from PyQt5.QtCore import QStandardPaths import pytest -from qutebrowser.utils import standarddir, utils, qtutils +from qutebrowser.utils import standarddir, utils, qtutils, version # Use a different application name for tests to make sure we don't change real @@ -399,12 +399,18 @@ class TestSystemData: """Test system data path.""" @pytest.mark.linux - def test_system_datadir_exist_linux(self, monkeypatch, tmpdir): + @pytest.mark.parametrize("is_flatpak, expected", [ + (True, "/app/share/qute_test"), + (False, "/usr/share/qute_test"), + ]) + def test_system_datadir_exist_linux(self, monkeypatch, tmpdir, + is_flatpak, expected): """Test that /usr/share/qute_test is used if path exists.""" monkeypatch.setenv('XDG_DATA_HOME', str(tmpdir)) monkeypatch.setattr(os.path, 'exists', lambda path: True) + monkeypatch.setattr(version, 'is_flatpak', lambda: is_flatpak) standarddir._init_data(args=None) - assert standarddir.data(system=True) == "/usr/share/qute_test" + assert standarddir.data(system=True) == expected @pytest.mark.linux def test_system_datadir_not_exist_linux(self, monkeypatch, tmpdir, -- cgit v1.2.3-54-g00ecf