From bd127f8abaec6ddee1768a353afc3b337949b294 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Wed, 21 Aug 2013 22:28:15 -0400 Subject: [PATCH] Shadow the built in tmpdir fixture to use our Path object * Uses the same generation method as the built in tmpdir, simply returns a different object type. --- tests/conftest.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 000000000..6df1a55b5 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,20 @@ +import py +import pytest + +from tests.lib.path import Path + + +@pytest.fixture +def tmpdir(request): + """ + Return a temporary directory path object which is unique to each test + function invocation, created as a sub directory of the base temporary + directory. The returned object is a ``tests.lib.path.Path`` object. + + This is taken from pytest itself but modified to return our typical + path object instead of py.path.local. + """ + name = request.node.name + name = py.std.re.sub("[\W]", "_", name) + tmp = request.config._tmpdirhandler.mktemp(name, numbered=True) + return Path(tmp) -- GitLab