kaste / mockito-python

Mockito is a spying framework
MIT License
123 stars 12 forks source link

Fix: support `mock(spec=SomeClass)` usage #51

Closed kaste closed 2 years ago

kaste commented 2 years ago

Support specifying the spec by using the keyword spec.

Although in the documentation it is always spelt mock(SomeClass) it is confusing to not allow the keyword invocation mock(spec=SomeClass) here to mean the same thing.

It can be considered a bug because using the keyword spec=X just ignored the argument and created a non-strict, non-specced (dumb) mock; basically a plain mock().

This came up here: https://stackoverflow.com/questions/72498759/python-mockito-how-do-i-set-up-async-mocks?noredirect=1#comment128270001_72498759