Title: Putting a function in a unittest.TestSuite doesn't work
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 2.7
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: michael.foord
Priority: normal Keywords:

Created on 2010-04-03 13:32 by michael.foord, last changed 2010-05-08 17:06 by michael.foord. This issue is now closed.

Messages (2)
msg102259 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-04-03 13:32
Putting functions (rather than TestCase instances) directly in TestSuites was never officially supported but it used to work:

>>> from unittest import TestSuite, TestResult
>>> def f(): pass
>>> s = TestSuite()
>>> s.addTest(f)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/compile/python-trunk/Lib/unittest/", line 85, in run
  File "/compile/python-trunk/Lib/unittest/", line 100, in _wrapped_run
    self._handleClassSetUp(test, result)
  File "/compile/python-trunk/Lib/unittest/", line 122, in _handleClassSetUp
    currentClass._classSetupFailed = False
TypeError: can't set attributes of built-in/extension type 'function'
msg105318 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-05-08 17:06
Committed revision 80997.
Date User Action Args
2010-05-08 17:06:53michael.foordsetstatus: open -> closed
resolution: accepted
messages: + msg105318

stage: needs patch -> resolved
2010-04-03 13:32:03michael.foordcreate