testing-cabal/mock

Question on release 4.0.3

Closed this issue · 2 comments

Hi,

Our project depends on mock and starting breaking with the release 4.0.3
It looks like it's due to this change: 902eea1#diff-8c27cb0892437c6ed89046ff1e003343bbab422f3f030a41d3a903c7fca93089L1548, which essentially removes the idempotency of the stop()-method.
This if-statement looked to be specifically introduced to support idempotency (see the original commit), so I was wondering what the reasoning was behind this reversal?

(Stack trace of how mock now fails for us can be found here: getmoto/moto#3535)

Thanks for the report. It mostly seems like an upstream issue in unittest.mock since the commit was made there too and backported. Can you confirm the issue with unittest.mock on latest Python 3.9? Can you please add a simple reproducer without moto or other dependencies so that it will be good to debug and also add the test to mock codebase for this.

Hi @tirkarthi, I haven't been able to create a simple reproducer, I'm afraid.
Some more investigation did show that we weren't using mocks properly in our project, and this change just highlighted that. Changing our approach to mocks made the error go away.

If/when I do manage to get a reproducible test case (without butchering the unittest.mock usage) I'll create an issue upstream.

Thanks for the response!