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
def ctx():
"""Mutable context bag shared between steps in one scenario."""
return {}
def odoo_env(env):
"""pytest-odoo's env fixture, re-exported for BDD step access."""
return env
@pytest.fixture
def odoo_env(request):
"""Provide the Odoo environment from the TransactionCase if available,
or from the pytest-odoo plugin's odoo_env fixture."""
return request.getfixturevalue('odoo_env')
def ctx():
"""Mutable context bag shared between steps in one scenario."""
return {}
# ================================================================= #