[New-bugs-announce] [issue40690] unittest: if FunctionTestCase is imported, the loader loads "tests" from it

Vitalii report at bugs.python.org
Tue May 19 16:17:05 EDT 2020


New submission from Vitalii <abvit89 at gmail.com>:

In [2]: from unittest import FunctionTestCase                                                                                                                                                                                  

In [3]: loader.loadTestsFromTestCase(FunctionTestCase)                                                                                                                                                                              
Out[3]: <unittest.suite.TestSuite tests=[<unittest.case.FunctionTestCase tec=runTest>]>

In [4]: test = _._tests[0]; test 
Out[4]: <unittest.case.FunctionTestCase tec=runTest>

In [5]: test._testFunc                                                                                                                                                                                                                
Out[5]: 'runTest'

In [6]: test._testFunc.__name__                                                                                                                                                                                                       
*** AttributeError: 'str' object has no attribute '__name__'

----------
components: Tests
messages: 369386
nosy: pwtail
priority: normal
severity: normal
status: open
title: unittest: if FunctionTestCase is imported, the loader loads "tests" from it
type: behavior
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40690>
_______________________________________


More information about the New-bugs-announce mailing list