classification
Title: unittest loader doesn't work with partial test functions
Type: Stage: patch review
Components: Versions: Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fried, jonash, lisroach, lukasz.langa, pitrou, xtreak
Priority: normal Keywords: patch, patch, patch

Created on 2019-01-18 01:25 by fried, last changed 2019-01-24 17:31 by lukasz.langa.

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 (6)
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 triager) 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
History
Date User Action Args
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