Clean up *_tmpdir fixtures

This commit is contained in:
Florian Bruhin 2017-09-15 14:32:03 +02:00
parent fa4ea912c9
commit 3d3391b55e

View File

@ -440,9 +440,8 @@ def config_tmpdir(monkeypatch, tmpdir):
Use this to avoid creating a 'real' config dir (~/.config/qute_test). Use this to avoid creating a 'real' config dir (~/.config/qute_test).
""" """
confdir = tmpdir / 'config' confdir = tmpdir / 'config'
path = str(confdir) confdir.ensure(dir=True)
os.mkdir(path) monkeypatch.setattr(standarddir, 'config', lambda auto=False: str(confdir))
monkeypatch.setattr(standarddir, 'config', lambda auto=False: path)
return confdir return confdir
@ -453,9 +452,8 @@ def data_tmpdir(monkeypatch, tmpdir):
Use this to avoid creating a 'real' data dir (~/.local/share/qute_test). Use this to avoid creating a 'real' data dir (~/.local/share/qute_test).
""" """
datadir = tmpdir / 'data' datadir = tmpdir / 'data'
path = str(datadir) datadir.ensure(dir=True)
os.mkdir(path) monkeypatch.setattr(standarddir, 'data', lambda system=False: str(datadir))
monkeypatch.setattr(standarddir, 'data', lambda system=False: path)
return datadir return datadir
@ -466,9 +464,8 @@ def runtime_tmpdir(monkeypatch, tmpdir):
Use this to avoid creating a 'real' runtime dir. Use this to avoid creating a 'real' runtime dir.
""" """
runtimedir = tmpdir / 'runtime' runtimedir = tmpdir / 'runtime'
path = str(runtimedir) runtimedir.ensure(dir=True)
os.mkdir(path) monkeypatch.setattr(standarddir, 'runtime', lambda: str(runtimedir))
monkeypatch.setattr(standarddir, 'runtime', lambda: path)
return runtimedir return runtimedir