Skip to content

Commit

Permalink
Merge PR #457 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by lmignon
  • Loading branch information
OCA-git-bot committed Oct 3, 2024
2 parents e561a79 + 4206320 commit e10ed90
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fastapi/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _create_test_client(
env: Environment = None,
dependency_overrides: dict[Callable[..., Any], Callable[..., Any]] = None,
raise_server_exceptions: bool = True,
testclient_kwargs=None,
):
"""
Create a test client for the given app or router.
Expand Down Expand Up @@ -112,7 +113,12 @@ def _create_test_client(
app.include_router(router)
app.dependency_overrides = dependencies
ctx_token = odoo_env_ctx.set(env)
testclient_kwargs = testclient_kwargs or {}
try:
yield TestClient(app, raise_server_exceptions=raise_server_exceptions)
yield TestClient(
app,
raise_server_exceptions=raise_server_exceptions,
**testclient_kwargs,
)
finally:
odoo_env_ctx.reset(ctx_token)

0 comments on commit e10ed90

Please sign in to comment.