@robdaemon Mocking in Python is so miserable, though you can at least work around this by using pytest’s fixtures to vend mocks instead.
@robdaemon I’ve internalized it and understand it now, but it’s still so, so annoying to deal with. I’m still looking for a half-decent pattern for doing DI for testing in Python.
@robdaemon I’m currently using pytest and its fixtures + monkeypatching (though I don’t know of any objective reason to use pytest monkey patching over unittest mocking - I do it mostly to remain within the same library so I don’t need to bounce across different documentation). At least w/pytest fixtures, I don’t need to worry about ordering.
Though even with monkeypatching, it’s still using unittest mocks, so the API there is still trash.