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: unittest loader doesn't work with partial test functions
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: fried, iritkatriel, jonash, lisroach, lukasz.langa, pitrou, xtreak
Priority: normal Keywords: patch, patch, patch

Created on 2019-01-18 01:25 by fried, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11600 merged fried, 2019-01-18 02:04
PR 11600 merged fried, 2019-01-18 02:04
PR 11600 merged fried, 2019-01-18 02:04
PR 11662 merged miss-islington, 2019-01-23 20:58
PR 11662 merged miss-islington, 2019-01-23 20:58
PR 11662 merged miss-islington, 2019-01-23 20:58
Messages (7)
msg333926 - (view) Author: Jason Fried (fried) * Date: 2019-01-18 01:25
https://github.com/python/cpython/blob/3.7/Lib/unittest/loader.py#L232

fullName = '%s.%s' % (testCaseClass.__module__, testFunc.__qualname__)

Instead we should probably replace testFunc.__qualname__ with attrname

I ran into this while running a test suite that built up test functions using partials and added them to the TestCase class with setattr. 

This works in 3.6.3
msg333927 - (view) Author: Jason Fried (fried) * Date: 2019-01-18 01:29
Oh this is broken in 3.7 trunk
msg333928 - (view) Author: Jason Fried (fried) * Date: 2019-01-18 01:44
working on a pull request
msg333938 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-01-18 04:42
Seems this was introduced with issue32071
msg334272 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2019-01-23 20:57
New changeset fd628cf5adaeee73eab579393cdff71c8f70cdf2 by Łukasz Langa (Jason Fried) in branch 'master':
bpo-35767: Fix unittest.loader to allow partials as test_functions (#11600)
https://github.com/python/cpython/commit/fd628cf5adaeee73eab579393cdff71c8f70cdf2
msg334310 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2019-01-24 17:31
New changeset 841387dd43e67b1800d10e4d7ce1f8cedc9f3706 by Łukasz Langa (Miss Islington (bot)) in branch '3.7':
bpo-35767: Fix unittest.loader to allow partials as test_functions (GH-11600) (#11662)
https://github.com/python/cpython/commit/841387dd43e67b1800d10e4d7ce1f8cedc9f3706
msg377278 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-09-21 19:43
Can this be closed now?
History
Date User Action Args
2022-04-11 14:59:10adminsetgithub: 79948
2020-09-23 04:04:02friedsetresolution: fixed
2020-09-23 04:03:01friedsetstatus: open -> closed
stage: patch review -> resolved
2020-09-21 19:43:15iritkatrielsetnosy: + iritkatriel
messages: + msg377278

components: + Tests
type: behavior
2019-01-24 17:31:03lukasz.langasetmessages: + msg334310
2019-01-23 20:58:30miss-islingtonsetpull_requests: + pull_request11466
2019-01-23 20:58:20miss-islingtonsetpull_requests: + pull_request11465
2019-01-23 20:58:12miss-islingtonsetpull_requests: + pull_request11464
2019-01-23 20:57:36lukasz.langasetmessages: + msg334272
2019-01-18 04:42:28xtreaksetkeywords: patch, patch, patch
nosy: + pitrou, jonash, xtreak
messages: + msg333938

2019-01-18 02:04:33friedsetkeywords: + patch
stage: patch review
pull_requests: + pull_request11318
2019-01-18 02:04:27friedsetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11317
2019-01-18 02:04:22friedsetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11316
2019-01-18 01:44:57friedsetmessages: + msg333928
2019-01-18 01:29:12friedsetmessages: + msg333927
2019-01-18 01:25:19friedcreate