Merged in hpk42/pytest-patches/reintroduce_pytest_fixture (pull request #279)
reintroduced _pytest fixture of the pytester plugin --HG-- branch : pytest-2.7
This commit is contained in:
commit
0cc9d7e6b6
|
@ -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)
|
||||
-----------------------------
|
||||
|
|
|
@ -15,6 +15,24 @@ from _pytest.core import HookCaller, add_method_wrapper
|
|||
|
||||
from _pytest.main import Session, EXIT_OK
|
||||
|
||||
# used at least by pytest-xdist plugin
|
||||
@pytest.fixture
|
||||
def _pytest(request):
|
||||
""" Return a helper which offers a gethookrecorder(hook)
|
||||
method which returns a HookRecorder instance which helps
|
||||
to make assertions about called hooks.
|
||||
"""
|
||||
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."""
|
||||
|
|
Loading…
Reference in New Issue