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:
parent
33cba1fe32
commit
d53c1b38eb
1 changed files with 6 additions and 7 deletions
|
|
@ -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 {}
|
||||
|
||||
|
||||
# ================================================================= #
|
||||
|
|
|
|||
Loading…
Reference in a new issue