From 3d3391b55e1d3e453c0342eace0167f8b11d154f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 15 Sep 2017 14:32:03 +0200 Subject: [PATCH] Clean up *_tmpdir fixtures --- tests/helpers/fixtures.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 4ac603d51..bd3f69a45 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -440,9 +440,8 @@ def config_tmpdir(monkeypatch, tmpdir): Use this to avoid creating a 'real' config dir (~/.config/qute_test). """ confdir = tmpdir / 'config' - path = str(confdir) - os.mkdir(path) - monkeypatch.setattr(standarddir, 'config', lambda auto=False: path) + confdir.ensure(dir=True) + monkeypatch.setattr(standarddir, 'config', lambda auto=False: str(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). """ datadir = tmpdir / 'data' - path = str(datadir) - os.mkdir(path) - monkeypatch.setattr(standarddir, 'data', lambda system=False: path) + datadir.ensure(dir=True) + monkeypatch.setattr(standarddir, 'data', lambda system=False: str(datadir)) return datadir @@ -466,9 +464,8 @@ def runtime_tmpdir(monkeypatch, tmpdir): Use this to avoid creating a 'real' runtime dir. """ runtimedir = tmpdir / 'runtime' - path = str(runtimedir) - os.mkdir(path) - monkeypatch.setattr(standarddir, 'runtime', lambda: path) + runtimedir.ensure(dir=True) + monkeypatch.setattr(standarddir, 'runtime', lambda: str(runtimedir)) return runtimedir