From 1d1d8063ec03515261317655cc88c942de2783fc Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 17 Nov 2015 21:25:11 +0100 Subject: [PATCH 1/3] Use hookwrapper instead of __multicall__. See #154. --- pytest_bdd/reporting.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pytest_bdd/reporting.py b/pytest_bdd/reporting.py index 870c454..8bb3ce2 100644 --- a/pytest_bdd/reporting.py +++ b/pytest_bdd/reporting.py @@ -145,9 +145,11 @@ class ScenarioReport(object): self.add_step_report(report) -def pytest_runtest_makereport(item, call, __multicall__): +@pytest.mark.hookwrapper +def pytest_runtest_makereport(item, call): """Store item in the report object.""" - rep = __multicall__.execute() + outcome = yield + rep = outcome.get_result() try: scenario_report = item.__scenario_report__ except AttributeError: @@ -155,7 +157,6 @@ def pytest_runtest_makereport(item, call, __multicall__): else: rep.scenario = scenario_report.serialize() rep.item = {"name": item.name} - return rep @pytest.mark.tryfirst From f75208d5f7b784c4f0dafcb44d7b01b15428e56d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 17 Nov 2015 21:29:24 +0100 Subject: [PATCH 2/3] Use add_hookspecs instead of addhooks. See #154. pluginmanager.addhooks was deprecated in pytest 2.8 and pluggy's add_hookspecs should be used instead. Falling back to addhooks for older pytest versions. --- pytest_bdd/plugin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pytest_bdd/plugin.py b/pytest_bdd/plugin.py index c335c8a..2827174 100644 --- a/pytest_bdd/plugin.py +++ b/pytest_bdd/plugin.py @@ -18,7 +18,12 @@ from .fixtures import * def pytest_addhooks(pluginmanager): """Register plugin hooks.""" from pytest_bdd import hooks - pluginmanager.addhooks(hooks) + try: + # pytest >= 2.8 + pluginmanager.add_hookspecs(hooks) + except AttributeError: + # pytest < 2.8 + pluginmanager.addhooks(hooks) @given('trace') From 6e5c70121da7dba31d3a62507c446b744b0301a6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 17 Nov 2015 21:33:44 +0100 Subject: [PATCH 3/3] Add myself to AUTHORS. --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 5ca2aa7..2eca9ab 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -12,6 +12,7 @@ These people have contributed to `pytest-bdd`, in alphabetical order: * `Andrey Makhnach `_ * `Aron Curzon `_ * `Dmitrijs Milajevs `_ +* `Florian Bruhin `_ * `Floris Bruynooghe `_ * `Harro van der Klauw `_ * `Laurence Rowe `_