Add a cache_tmpdir fixture

This commit is contained in:
Florian Bruhin 2017-11-21 14:09:30 +01:00
parent c9d42c8bea
commit a451e8ac9d

View File

@ -458,6 +458,18 @@ def runtime_tmpdir(monkeypatch, tmpdir):
return runtimedir
@pytest.fixture
def cache_tmpdir(monkeypatch, tmpdir):
"""Set tmpdir/cache as the cachedir.
Use this to avoid creating a 'real' cache dir (~/.cache/qute_test).
"""
cachedir = tmpdir / 'cache'
cachedir.ensure(dir=True)
monkeypatch.setattr(standarddir, 'cache', lambda: str(cachedir))
return cachedir
@pytest.fixture
def redirect_webengine_data(data_tmpdir, monkeypatch):
"""Set XDG_DATA_HOME and HOME to a temp location.