From 9d5182eaad5e01949e9da5ac6bec9eb83a6bc33e Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 22 Apr 2015 17:06:00 +0200 Subject: [PATCH] reintroduced _pytest fixture of the pytester plugin which is used at least by pytest-xdist. --HG-- branch : reintroduce_pytest_fixture --- CHANGELOG | 2 ++ _pytest/pytester.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index bd5b2eb81..4ffce2dcd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -24,6 +24,8 @@ - fixed regression to 2.6.4 which surfaced e.g. in lost stdout capture printing when tests raised SystemExit. Thanks Holger Krekel. +- reintroduced _pytest fixture of the pytester plugin which is used + at least by pytest-xdist. 2.7.0 (compared to 2.6.4) ----------------------------- diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 7057814ff..404e07fa9 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -15,6 +15,19 @@ from _pytest.core import HookCaller, add_method_wrapper from _pytest.main import Session, EXIT_OK +# used at least by pytest-xdist plugin +def pytest_funcarg___pytest(request): + return PytestArg(request) + +class PytestArg: + def __init__(self, request): + self.request = request + + def gethookrecorder(self, hook): + hookrecorder = HookRecorder(hook._pm) + self.request.addfinalizer(hookrecorder.finish_recording) + return hookrecorder + def get_public_names(l): """Only return names from iterator l without a leading underscore."""