This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: patch.object should raise another error when first argument is a str
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Elena.Oat, cjw296, lisroach, mariocj89, michael.foord, terry.reedy, xtreak
Priority: normal Keywords: patch

Created on 2019-11-03 02:30 by Elena.Oat, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17034 merged Elena.Oat, 2019-11-03 19:42
PR 17510 merged miss-islington, 2019-12-08 20:15
PR 17511 merged miss-islington, 2019-12-08 20:18
Messages (5)
msg355886 - (view) Author: Elena Oat (Elena.Oat) * Date: 2019-11-03 02:30
When using patch.object with first argument as a string, e.g. 
´´patch.object('SomeClass', 'somemethod')´´ this raises ´´AttributeError: Something does not have the attribute 'do_something'´´. 
This should instead warn user that the correct type for the first argument is a class.
msg356258 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-11-08 19:57
This enhancement request (no backports) is about the unittest.mock patch.object.
https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch.object
msg358023 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2019-12-08 20:14
New changeset cd90a52983db34896a6335a572d55bdda274778f by Chris Withers (Elena Oat) in branch 'master':
bpo-38669: patch.object now raises a helpful error (GH17034)
https://github.com/python/cpython/commit/cd90a52983db34896a6335a572d55bdda274778f
msg358057 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2019-12-09 06:59
New changeset 4594565b56e9c99d2d3fb7549041bbca5ecba8e2 by Chris Withers (Miss Islington (bot)) in branch '3.8':
bpo-38669: patch.object now raises a helpful error (GH17510)
https://github.com/python/cpython/commit/4594565b56e9c99d2d3fb7549041bbca5ecba8e2
msg358058 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2019-12-09 06:59
New changeset 41973c99fdfdc78315e819661e279bdcc2f058b1 by Chris Withers (Miss Islington (bot)) in branch '3.7':
bpo-38669: patch.object now raises a helpful error (GH17511)
https://github.com/python/cpython/commit/41973c99fdfdc78315e819661e279bdcc2f058b1
History
Date User Action Args
2022-04-11 14:59:22adminsetgithub: 82850
2019-12-09 07:00:24cjw296setstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-12-09 06:59:26cjw296setmessages: + msg358058
2019-12-09 06:59:16cjw296setmessages: + msg358057
2019-12-08 20:18:10miss-islingtonsetpull_requests: + pull_request16987
2019-12-08 20:15:08miss-islingtonsetpull_requests: + pull_request16986
2019-12-08 20:14:44cjw296setmessages: + msg358023
2019-11-08 19:57:53terry.reedysetversions: - Python 3.5, Python 3.6, Python 3.7, Python 3.8
nosy: + terry.reedy

messages: + msg356258

type: enhancement
2019-11-03 19:42:26Elena.Oatsetkeywords: + patch
stage: patch review
pull_requests: + pull_request16549
2019-11-03 02:58:59xtreaksetnosy: + cjw296, michael.foord, lisroach, mariocj89, xtreak
2019-11-03 02:30:39Elena.Oatcreate