diff --git a/CHANGES.rst b/CHANGES.rst index 6bedb51..74ef87c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,7 +7,7 @@ Unreleased - 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 `_ `#544 `_ `#525 `_ - ``parsers.re`` now does a `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 `_ - Require pytest>=6.2 `#534 `_ - +- Using modern way to specify hook options to avoid deprecation warnings with pytest >=7.2. 6.0.1 ----- diff --git a/pytest_bdd/plugin.py b/pytest_bdd/plugin.py index 437c8be..486cdf8 100644 --- a/pytest_bdd/plugin.py +++ b/pytest_bdd/plugin.py @@ -62,7 +62,7 @@ def add_bdd_ini(parser: Parser) -> None: parser.addini("bdd_features_base_dir", "Base features directory.") -@pytest.mark.trylast +@pytest.hookimpl(trylast=True) def pytest_configure(config: Config) -> None: """Configure all subplugins.""" CONFIG_STACK.append(config) @@ -76,18 +76,18 @@ def pytest_unconfigure(config: Config) -> None: cucumber_json.unconfigure(config) -@pytest.mark.hookwrapper +@pytest.hookimpl(hookwrapper=True) def pytest_runtest_makereport(item: Item, call: CallInfo) -> Generator[None, _Result, None]: outcome = yield reporting.runtest_makereport(item, call, outcome.get_result()) -@pytest.mark.tryfirst +@pytest.hookimpl(tryfirst=True) def pytest_bdd_before_scenario(request: FixtureRequest, feature: Feature, scenario: Scenario) -> None: reporting.before_scenario(request, feature, scenario) -@pytest.mark.tryfirst +@pytest.hookimpl(tryfirst=True) def pytest_bdd_step_error( request: FixtureRequest, feature: Feature, @@ -100,14 +100,14 @@ def pytest_bdd_step_error( reporting.step_error(request, feature, scenario, step, step_func, step_func_args, exception) -@pytest.mark.tryfirst +@pytest.hookimpl(tryfirst=True) def pytest_bdd_before_step( request: FixtureRequest, feature: Feature, scenario: Scenario, step: Step, step_func: Callable ) -> None: reporting.before_step(request, feature, scenario, step, step_func) -@pytest.mark.tryfirst +@pytest.hookimpl(tryfirst=True) def pytest_bdd_after_step( request: FixtureRequest, feature: Feature,