mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Restrict use of Mock objects as specs (GH-31090)
Follow-on to https://github.com/python/cpython/pull/25326 This covers cases where mock objects are passed directly to spec.
This commit is contained in:
parent
8726067ace
commit
6394e981ad
4 changed files with 20 additions and 3 deletions
|
@ -0,0 +1 @@
|
|||
Mocks can no longer be provided as the specs for other Mocks. As a result, an already-mocked object cannot be passed to `mock.Mock()`. This can uncover bugs in tests since these Mock-derived Mocks will always pass certain tests (e.g. isinstance) and builtin assert functions (e.g. assert_called_once_with) will unconditionally pass.
|
Loading…
Add table
Add a link
Reference in a new issue