Repository navigation
autospec for spy: remove if else which was in place for python < 3.7 - #399
Conversation
|
Hey @yesthesoup, thanks for the follow up!
To confirm, would any Python 3.8+ user be affected by this change in any way? |
I believe they would only be affected if their tests were silently passing when they shouldn't be like in the examples in the Python docs: https://docs.python.org/3/library/unittest.mock.html#auto-speccing mock = Mock(name='Thing', return_value=None)
mock(1, 2, 3)
mock.assret_called_once_with(4, 5, 6) # would not throw error in their current tests - silently passe.g. if they had some class method / static method spies that pytest-mock was previously creating with Should be a very small percentage of users, maybe none, and if this is merged, it would probably be good for those affected to update and have those silent failures fixed. |
|
I see, thanks! I guess we might leave out this from the CHANGELOG then for now, and if somebody is affected by this, we can add a note accordingly. Thanks again! |
I made this PR in the past #224 which worked on an
if/elsefor thespyfeature to get around a bug in python that was fixed in 3.7. Now that this library supports only >= 3.8 this check is no longer needed.I suppose this would be "breaking changes" for anyone who may be incorrectly calling methods on class/static method spies?