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 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Have you tried registering the mock in the container-local registry? Overwrite predates this feature. |
Beta Was this translation helpful? Give feedback.
Container-local registries predate
overwrite_value
and 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.