Beispiel #1
0
 def test_system_datadir_unsupportedos(self, monkeypatch, tmpdir,
                                       fake_args):
     """Test that system-wide path is not used on non-Linux OS."""
     fake_args.basedir = str(tmpdir)
     monkeypatch.setattr('sys.platform', "potato")
     standarddir._init_data(args=fake_args)
     assert standarddir.data(system=True) == standarddir.data()
Beispiel #2
0
 def test_system_datadir_not_exist_linux(self, monkeypatch, tmpdir,
                                         fake_args):
     """Test that system-wide path isn't used on linux if path not exist."""
     fake_args.basedir = str(tmpdir)
     monkeypatch.setattr(os.path, 'exists', lambda path: False)
     standarddir._init_data(args=fake_args)
     assert standarddir.data(system=True) == standarddir.data()
Beispiel #3
0
 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) == expected
Beispiel #4
0
def test_fake_windows(tmpdir, monkeypatch, what):
    """Make sure the config/data/cache dirs are correct on a fake Windows."""
    monkeypatch.setattr(standarddir.QStandardPaths, 'writableLocation',
                        lambda typ: str(tmpdir / APPNAME))

    standarddir._init_config(args=None)
    standarddir._init_data(args=None)
    standarddir._init_cache(args=None)

    func = getattr(standarddir, what)
    assert func() == str(tmpdir / APPNAME / what)
def test_fake_windows(tmpdir, monkeypatch, what):
    """Make sure the config/data/cache dirs are correct on a fake Windows."""
    monkeypatch.setattr(standarddir.QStandardPaths, 'writableLocation',
                        lambda typ: str(tmpdir / APPNAME))

    standarddir._init_config(args=None)
    standarddir._init_data(args=None)
    standarddir._init_cache(args=None)

    func = getattr(standarddir, what)
    assert func() == str(tmpdir / APPNAME / what)
Beispiel #6
0
def test_fake_haiku(tmpdir, monkeypatch):
    """Test getting data dir on HaikuOS."""
    locations = {
        QStandardPaths.DataLocation: '',
        QStandardPaths.ConfigLocation: str(tmpdir / 'config' / APPNAME),
    }
    monkeypatch.setattr(standarddir.QStandardPaths, 'writableLocation',
                        locations.get)
    monkeypatch.setattr(standarddir.sys, 'platform', 'haiku1')

    standarddir._init_data(args=None)
    assert standarddir.data() == str(tmpdir / 'config' / APPNAME / 'data')
def test_fake_haiku(tmpdir, monkeypatch):
    """Test getting data dir on HaikuOS."""
    locations = {
        QStandardPaths.DataLocation: '',
        QStandardPaths.ConfigLocation: str(tmpdir / 'config' / APPNAME),
    }
    monkeypatch.setattr(standarddir.QStandardPaths, 'writableLocation',
                        locations.get)
    monkeypatch.setattr(standarddir.sys, 'platform', 'haiku1')

    standarddir._init_data(args=None)
    assert standarddir.data() == str(tmpdir / 'config' / APPNAME / 'data')