]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-36593: Fix isinstance check for Mock objects with spec executed under tracing...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 13 Apr 2019 19:31:58 +0000 (12:31 -0700)
committerGitHub <noreply@github.com>
Sat, 13 Apr 2019 19:31:58 +0000 (12:31 -0700)
commitf3a9d722d77753f5110e35f46bd61732c0cb81c1
treea4ee9bacbef96638c2e0fd9a9f3565512012de9e
parentd28aaa7df8bcd46f4135d240d041b0b171b664cc
bpo-36593: Fix isinstance check for Mock objects with spec executed under tracing (GH-12790)

In Python having a trace function in effect while mock is imported causes isinstance to be wrong for MagicMocks. This is due to the usage of super() in some class methods, as this sets the __class__ attribute. To avoid this, as a workaround, alias the usage of super .
(cherry picked from commit 830b43d03cc47a27a22a50d777f23c8e60820867)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
Lib/unittest/mock.py
Lib/unittest/test/testmock/testmock.py
Misc/NEWS.d/next/Library/2019-04-11-22-11-24.bpo-36598.hfzDUl.rst [new file with mode: 0644]