We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi!
I discovered that dependency overriding does not work with Litestar. I provide you with two tests with which you can try to reproduce the error:
def test_litestar_di_override_fail_on_provider_override() -> None: with TestClient(app=app) as client: with DIContainer.int_fn.override_context(12345364758999): response = client.get("/router/controller/handler") assert response.status_code == HTTP_200_OK, response.text assert response.json() == { "app_dependency": False, "controller_dependency": ["some"], "local_dependency": 12345364758999, # ASSERTION ERROR HERE "router_dependency": "", } def test_litestar_di_override_fail_on_override_providers() -> None: overrides = { 'int_fn': 12345364758999, } with TestClient(app=app) as client: with DIContainer.override_providers(overrides): response = client.get("/router/controller/handler") assert response.status_code == HTTP_200_OK, response.text assert response.json() == { "app_dependency": False, "controller_dependency": ["some"], "local_dependency": 12345364758999, # ASSERTION ERROR HERE "router_dependency": "", }
I haven’t yet figured out what’s going on: in the overriding logic or the litestar itself
Litestar version: 2.12.1 that-depends version: latest
The text was updated successfully, but these errors were encountered:
Hi! Interesting, overriding in fastapi works, Trying to figure out also
Sorry, something went wrong.
Seems like Litestar for some reason clones object, passed to Provide. Because it has different id inside test client request and outside.
Litestar
Successfully merging a pull request may close this issue.
Hi!
I discovered that dependency overriding does not work with Litestar. I provide you with two tests with which you can try to reproduce the error:
I haven’t yet figured out what’s going on: in the overriding logic or the litestar itself
Litestar version: 2.12.1
that-depends version: latest
The text was updated successfully, but these errors were encountered: