testing with flask overwrites global Registry? #84
|
I have a global svcs.Registry object for my flask App. In tests, I use However, after the test runs, my mock service is still registered. This is a big problem. Looking at the code, I cannot see how this could possibly work, since This might be a bug, I'm not sure. I expected |
Answered by
hynek
Apr 26, 2024
Replies: 1 comment 4 replies
|
Have you tried registering the mock in the container-local registry? Overwrite predates this feature. |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Container-local registries predate
overwrite_valueand they have different semantics so using it would be a breaking change.I think the more correct way would be to deprecate overwrite_value and maybe in Flask's case (since it has global side-effects) add a new convenience API. But really, it's just
svcs.flask.container.register_local_XXX(), no?I'm not super-keen to add new APIs before settling #70, though.