Skip to content

Commit 689b6a9

Browse files
committed
Use modern approach to specify hook options
The old way using marks is being deprecated in pytest 7.2: pytest-dev/pytest#9118
1 parent 15e6e69 commit 689b6a9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

CHANGES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Unreleased
77
- Step functions can now be decorated multiple times with @given, @when, @then. Previously every decorator would override ``converters`` and ``target_fixture`` every at every application. `#534 <https://github.com/pytest-dev/pytest-bdd/pull/534>`_ `#544 <https://github.com/pytest-dev/pytest-bdd/pull/544>`_ `#525 <https://github.com/pytest-dev/pytest-bdd/issues/525>`_
88
- ``parsers.re`` now does a `fullmatch <https://docs.python.org/3/library/re.html#re.fullmatch>`_ instead of a partial match. This is to make it work just like the other parsers, since they don't ignore non-matching characters at the end of the string. `#539 <https://github.com/pytest-dev/pytest-bdd/pull/539>`_
99
- Require pytest>=6.2 `#534 <https://github.com/pytest-dev/pytest-bdd/pull/534>`_
10-
10+
- Using modern way to specify hook options to avoid deprecation warnings with pytest >=7.2.
1111

1212
6.0.1
1313
-----

pytest_bdd/plugin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def add_bdd_ini(parser: Parser) -> None:
6262
parser.addini("bdd_features_base_dir", "Base features directory.")
6363

6464

65-
@pytest.mark.trylast
65+
@pytest.hookimpl(trylast=True)
6666
def pytest_configure(config: Config) -> None:
6767
"""Configure all subplugins."""
6868
CONFIG_STACK.append(config)
@@ -76,18 +76,18 @@ def pytest_unconfigure(config: Config) -> None:
7676
cucumber_json.unconfigure(config)
7777

7878

79-
@pytest.mark.hookwrapper
79+
@pytest.hookimpl(hookwrapper=True)
8080
def pytest_runtest_makereport(item: Item, call: CallInfo) -> Generator[None, _Result, None]:
8181
outcome = yield
8282
reporting.runtest_makereport(item, call, outcome.get_result())
8383

8484

85-
@pytest.mark.tryfirst
85+
@pytest.hookimpl(tryfirst=True)
8686
def pytest_bdd_before_scenario(request: FixtureRequest, feature: Feature, scenario: Scenario) -> None:
8787
reporting.before_scenario(request, feature, scenario)
8888

8989

90-
@pytest.mark.tryfirst
90+
@pytest.hookimpl(tryfirst=True)
9191
def pytest_bdd_step_error(
9292
request: FixtureRequest,
9393
feature: Feature,
@@ -100,14 +100,14 @@ def pytest_bdd_step_error(
100100
reporting.step_error(request, feature, scenario, step, step_func, step_func_args, exception)
101101

102102

103-
@pytest.mark.tryfirst
103+
@pytest.hookimpl(tryfirst=True)
104104
def pytest_bdd_before_step(
105105
request: FixtureRequest, feature: Feature, scenario: Scenario, step: Step, step_func: Callable
106106
) -> None:
107107
reporting.before_step(request, feature, scenario, step, step_func)
108108

109109

110-
@pytest.mark.tryfirst
110+
@pytest.hookimpl(tryfirst=True)
111111
def pytest_bdd_after_step(
112112
request: FixtureRequest,
113113
feature: Feature,

0 commit comments

Comments
 (0)