From 384977c20a2cdd14f84009c9e48e8456e3f5d698 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 27 Mar 2024 16:54:21 -0400 Subject: [PATCH] Support pytest_bdd 7.1.2 and later Fix #1875. --- tests/lib/when_steps.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/lib/when_steps.py b/tests/lib/when_steps.py index 71252f866..4cd7d559f 100644 --- a/tests/lib/when_steps.py +++ b/tests/lib/when_steps.py @@ -7,7 +7,13 @@ from pytest_bdd import when from pytest_bdd.parsers import parse from pytest_bdd.parsers import re -from pytest_bdd.steps import inject_fixture + +# This is an undocumented and unsupported function: +# https://github.com/pytest-dev/pytest-bdd/issues/684 +try: + from pytest_bdd.compat import inject_fixture # pytest_bdd 7.1.2 and later +except ImportError: + from pytest_bdd.steps import inject_fixture # pytest_bdd 7.1.1 and earlier from jrnl.main import run