From 663f824fc457cd26b5e88f207d8a102f4d372a13 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 21 Nov 2013 14:54:46 +0100 Subject: [PATCH] simplify basedir isolation --- testing/conftest.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/testing/conftest.py b/testing/conftest.py index c96cb54f0..204c4490e 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -12,6 +12,7 @@ def pytest_addoption(parser): help=("run FD checks if lsof is available")) def pytest_configure(config): + config._basedir = py.path.local() if config.getvalue("lsof"): try: out = py.process.cmdexec("lsof -p %d" % pid) @@ -42,12 +43,8 @@ def check_open_files(config): config._numfiles = len(lines2) raise AssertionError("\n".join(error)) -@pytest.mark.tryfirst # XXX rather do item.addfinalizer -def pytest_runtest_setup(item): - item._oldir = py.path.local() - def pytest_runtest_teardown(item, __multicall__): - item._oldir.chdir() + item.config._basedir.chdir() if hasattr(item.config, '_numfiles'): x = __multicall__.execute() check_open_files(item.config)