You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't try to mock context manager; use a simple class instead
This one's related to #38. It turns out that while trying to mock a
context manager kind of works, it will do the wrong thing in edge cases
like when an exception is thrown from inside a `with` block, silently
swallowing it and causing a return that's completely wrong.
There may be some way to fix the mock to make it do the right thing, but
instead of getting fancier with these mocks that are already awful,
instead repair the problem by defining a plain class that implements
context manager and just use that.
0 commit comments