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.makeSuite undocumented and "obsolete" - but what to use instead?
Type: Stage:
Components: Documentation Versions: Python 2.4, Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, giampaolo.rodola, purcell, slinkp, techtonik
Priority: normal Keywords:

Created on 2008-04-29 22:26 by slinkp, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg65986 - (view) Author: Paul Winkler (slinkp) * Date: 2008-04-29 22:26
A comment in unittest.py says "these functions should be considered
obsolete". But I've seen a lot of code in the wild still using
unittest.makeSuite(MyTestCase)... in fact it's used frequently in the
python standard library tests.

And I don't see a replacement for this use case: given a subclass of
TestCase, conveniently turn all its test* methods into a suite. How are
we supposed to do that now?

Either makeSuite should be documented, or a suitable replacement should
be provided and documented.
msg66622 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-11 11:02
The replacement is TestLoader().loadTestsFromTestCase(), and it's
already in a prominent place in the docs:

"""
Instead of :func:`unittest.main`, there are other ways to run the tests
with a
finer level of control, less terse output, and no requirement to be run
from the
command line.  For example, the last two lines may be replaced with::

   suite =
unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
   unittest.TextTestRunner(verbosity=2).run(suite)
"""

Closing as "works for me".
msg177820 - (view) Author: anatoly techtonik (techtonik) Date: 2012-12-20 13:58
What about?

   suite = unittest.makeSuite(SConfTestCase, 'test_')
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46973
2012-12-20 13:58:41techtoniksetnosy: + techtonik
messages: + msg177820
2008-05-11 11:02:15georg.brandlsetstatus: open -> closed
resolution: works for me
messages: + msg66622
2008-04-30 13:12:32giampaolo.rodolasetnosy: + giampaolo.rodola
2008-04-29 22:41:39benjamin.petersonsetnosy: + purcell
2008-04-29 22:26:30slinkpcreate