tests: ensure cleanup with configs via get_config()

Also done in test_pluginmanager, although no resource warnings are
there at least.

Fixes https://github.com/pytest-dev/pytest/issues/4355.
This commit is contained in:
Daniel Hahler
2019-03-27 22:34:37 +01:00
parent aae02863db
commit d17ea7a9c0
3 changed files with 23 additions and 23 deletions

View File

@@ -375,6 +375,15 @@ def testdir(request, tmpdir_factory):
return Testdir(request, tmpdir_factory)
@pytest.fixture
def _config_for_test():
from _pytest.config import get_config
config = get_config()
yield config
config._ensure_unconfigure() # cleanup, e.g. capman closing tmpfiles.
rex_outcome = re.compile(r"(\d+) ([\w-]+)")