summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorMatthew Suozzo <msuozzo@google.com>2021-04-10 03:45:50 (GMT)
committerGitHub <noreply@github.com>2021-04-10 03:45:50 (GMT)
commitdccdc500f9b5dab0a20407ae0178d393796a8828 (patch)
treea48fd0cbd5857345cd084e47f93675e56a857323 /Misc
parentba1db571987c65672d9c06789e9852313ed2412a (diff)
downloadcpython-dccdc500f9b5dab0a20407ae0178d393796a8828.zip
cpython-dccdc500f9b5dab0a20407ae0178d393796a8828.tar.gz
cpython-dccdc500f9b5dab0a20407ae0178d393796a8828.tar.bz2
bpo-43478: Restrict use of Mock objects as specs (GH-25326)
* Restrict using Mock objects as specs as this is always a test bug where the resulting mock is misleadingly useless. * Skip a broken test that exposes a bug elsewhere in mock (noted in the original issue).
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2021-04-10-03-30-36.bpo-43478.iZcBTq.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2021-04-10-03-30-36.bpo-43478.iZcBTq.rst b/Misc/NEWS.d/next/Library/2021-04-10-03-30-36.bpo-43478.iZcBTq.rst
new file mode 100644
index 0000000..aaa1992
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-04-10-03-30-36.bpo-43478.iZcBTq.rst
@@ -0,0 +1 @@
+Mocks can no longer be used as the specs for other Mocks. As a result, an already-mocked object cannot have an attribute mocked using `autospec=True` or be the subject of a `create_autospec(...)` call. 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. \ No newline at end of file