classification
Title: unittest.mock's patch.object and patch.dict are not supported on classmethod, propery and staticmethod
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: cjw296, jacksonriley, mariocj89, michael.foord, remi.lapeyre, xtreak
Priority: normal Keywords:

Created on 2019-02-23 06:51 by xtreak, last changed 2019-11-12 11:28 by jacksonriley. This issue is now closed.

Messages (4)
msg336372 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-02-23 06:51
While looking into the unittest.mock tests I came across test_patch_descriptor [0] which makes an early return since patch.object and patch.dict are not supported on staticmethod, classmethod and property as noted in the comment. The tests still fail on master. The test was added during initial addition of mock to stdlib (commit 345266aa7e7) and I couldn't find any issues related to this. So I am filing this if someones wants to fix it.

[0] https://github.com/python/cpython/blob/175421b58cc97a2555e474f479f30a6c5d2250b0/Lib/unittest/test/testmock/testpatch.py#L667
msg356426 - (view) Author: Jackson Riley (jacksonriley) * Date: 2019-11-12 09:18
Hi Karthikeyan,

It seems that test_patch_descriptor has been removed by Chris Withers on 1st of May 2019 under commit adbf178.

I would therefore propose that this bug be marked as closed/resolved.

Cheers,
Jackson
msg356439 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-11-12 11:07
Thanks Jackson for the information. I am fine with closing it as outdated and one can reopen if they need this along with reviving the removed tests in the PR.
msg356445 - (view) Author: Jackson Riley (jacksonriley) * Date: 2019-11-12 11:28
Thanks Karthikeyan!
History
Date User Action Args
2019-11-12 11:28:07jacksonrileysetmessages: + msg356445
2019-11-12 11:07:20xtreaksetstatus: open -> closed
resolution: out of date
messages: + msg356439

stage: resolved
2019-11-12 09:18:56jacksonrileysetnosy: + jacksonriley
messages: + msg356426
2019-02-23 13:49:42remi.lapeyresetnosy: + remi.lapeyre
2019-02-23 06:51:44xtreakcreate