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: MagicMock should support `__fspath__`
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Maxime Belanger, michael.foord, vstinner, xtreak
Priority: normal Keywords: patch

Created on 2018-10-19 00:29 by Maxime Belanger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9960 merged maxbelanger, 2018-10-19 01:01
Messages (4)
msg328014 - (view) Author: Maxime Belanger (Maxime Belanger) Date: 2018-10-19 00:29
We have plenty of tests calling into `os.path.*` functions, and as Python 3.6+ gets more stringent about checking for `os.PathLike` compliance, it would greatly simplify our lives for `MagicMock` to support `__fspath__`.
msg328498 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-25 21:49
New changeset 6c83d9f4a72905d968418bef670bb3091d2744db by Victor Stinner (Max Bélanger) in branch 'master':
bpo-35022: unittest.mock.MagicMock now also supports __fspath__ (GH-9960)
https://github.com/python/cpython/commit/6c83d9f4a72905d968418bef670bb3091d2744db
msg328499 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-25 21:51
Thanks Maxime Belanger for your contribution! Thanks Mario Corchero for the review.


Oh, you added Python 3.7 to this issue, but sadly we don't add new features to minor Python versions (like Python 3.7.2) :-( Otherwise, it would mean that depending on the minor version, you may or may get the feature...

You will have to workaround MagicMock limitation until Python 3.8 is released.
msg344793 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-06-06 08:39
Closing this as resolved since this is merged for 3.8. Thank you all.
History
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79203
2019-06-06 08:39:46xtreaksetstatus: open -> closed
resolution: fixed
messages: + msg344793

stage: patch review -> resolved
2018-10-25 21:51:31vstinnersetmessages: + msg328499
versions: - Python 3.7
2018-10-25 21:49:03vstinnersetnosy: + vstinner
messages: + msg328498
2018-10-19 02:41:36ned.deilysetnosy: + michael.foord
2018-10-19 01:50:07xtreaksetnosy: + xtreak
2018-10-19 01:01:22maxbelangersetkeywords: + patch
stage: patch review
pull_requests: + pull_request9307
2018-10-19 00:29:51Maxime Belangercreate