Closed ghost closed 3 years ago
It's interesting why CI didn't catch this during backport tests or probably it had a fixed version of Python. As per the report I guess it's an issue with tests using unittest.mock and not the actual functionality.
@len-chambley, you're absolutely correct. See https://github.com/testing-cabal/mock/pull/497.
@tirkarthi - we weren't testing against 3.9 and there were a couple of places where we were using unittest.mock
when we should have been using mock.mock
. I believe the PR fixes both problems.
It's also happening with Python 3.10.1, #497 fixes it.
What versions are you using?
What happened?
Mock fails its test suite, more precisely the test
test_bool_not_called_when_passing_spec_arg()
withAssertionError: 1 != 0
.I believe that the culprit is a not completely backported/adapted patch, namely f7e3ea85b4f99604e8e05f4659825f69f3f29bc6. The test code (as in c3153c8f572b689b951482f599fa5faded012dc7) is
which solely tests
unittest.mock
which is the builtin Python implementation and not the implementation provided by this package (which would bemock
without leadingunittest.
). Replacingunittest.mock
withmock
lets the test pass.If the above analysis is correct, than maybe also the tests
test_isinstance_under_settrace()
andtest_all()
need to replaceunittest.mock
withmock
though these tests pass on my system with and without modifications (though I have not tested with other Python versions).It is important to note that a Python version which does not have the fix for bpo-42532 must be used to reproduce (e.g. Python 3.9.0).