fix: add odoo_env fixture for BDD step access

Added a simple function-scoped fixture that wraps pytest-odoo's 'env'
fixture and re-exports it as 'odoo_env' for BDD step definitions.
This allows pytest-bdd scenarios to inject the Odoo environment
into step functions that expect the 'odoo_env' parameter.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Nicholas Riegel 2026-05-30 00:37:27 -04:00
parent 33cba1fe32
commit d53c1b38eb

View file

@ -24,16 +24,15 @@ scenarios('../features/notification_email.feature')
# ================================================================= # # ================================================================= #
@pytest.fixture @pytest.fixture
def ctx(): def odoo_env(env):
"""Mutable context bag shared between steps in one scenario.""" """pytest-odoo's env fixture, re-exported for BDD step access."""
return {} return env
@pytest.fixture @pytest.fixture
def odoo_env(request): def ctx():
"""Provide the Odoo environment from the TransactionCase if available, """Mutable context bag shared between steps in one scenario."""
or from the pytest-odoo plugin's odoo_env fixture.""" return {}
return request.getfixturevalue('odoo_env')
# ================================================================= # # ================================================================= #