[Pytest-commit] commit/pytest: flub: Merged in hpk42/pytest-patches/reintroduce_pytest_fixture (pull request #279)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Apr 23 01:52:19 CEST 2015
1 new commit in pytest:
https://bitbucket.org/pytest-dev/pytest/commits/6f7fb5f6a382/
Changeset: 6f7fb5f6a382
Branch: pytest-2.7
User: flub
Date: 2015-04-22 23:52:13+00:00
Summary: Merged in hpk42/pytest-patches/reintroduce_pytest_fixture (pull request #279)
reintroduced _pytest fixture of the pytester plugin
Affected #: 2 files
diff -r b89271e4512145c7a723a49ac760ee39240531f5 -r 6f7fb5f6a3822d0736eb3c0ac405441c17705940 CHANGELOG
--- 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 -r b89271e4512145c7a723a49ac760ee39240531f5 -r 6f7fb5f6a3822d0736eb3c0ac405441c17705940 _pytest/pytester.py
--- a/_pytest/pytester.py
+++ b/_pytest/pytester.py
@@ -15,6 +15,24 @@
from _pytest.main import Session, EXIT_OK
+# used at least by pytest-xdist plugin
+ at 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."""
Repository URL: https://bitbucket.org/pytest-dev/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list