summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorMatthew Suozzo <msuozzo@google.com>2022-02-03 08:41:19 (GMT)
committerGitHub <noreply@github.com>2022-02-03 08:41:19 (GMT)
commit6394e981adaca2c0daa36c8701611e250d74024c (patch)
treee045af3b3a17ab2bfa72e44aa711ad046c8ba4bb /Misc
parent8726067ace98a27557e9fdf1a8e1c509c37cfcfc (diff)
downloadcpython-6394e981adaca2c0daa36c8701611e250d74024c.zip
cpython-6394e981adaca2c0daa36c8701611e250d74024c.tar.gz
cpython-6394e981adaca2c0daa36c8701611e250d74024c.tar.bz2
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.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Tests/2022-02-03-00-21-32.bpo-43478.0nfcam.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Tests/2022-02-03-00-21-32.bpo-43478.0nfcam.rst b/Misc/NEWS.d/next/Tests/2022-02-03-00-21-32.bpo-43478.0nfcam.rst
new file mode 100644
index 0000000..7c8fc47
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2022-02-03-00-21-32.bpo-43478.0nfcam.rst
@@ -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.