[New-bugs-announce] [issue15132] Let unittest.TestProgram()'s defaultTest argument be a list

Chris Jerdonek report at bugs.python.org
Fri Jun 22 10:25:30 CEST 2012

New submission from Chris Jerdonek <chris.jerdonek at gmail.com>:

It would be nice if unittest.TestProgram(), aka unittest.main(), allowed one to set self.testNames by programmatically passing in a list of test names.

Currently, unittest.main() almost allows this: the constructor sets self.testNames to a 1-tuple containing the value of the defaultTest argument.  But defaultTest can only be a string, not a list of test names.

A way around this is to pass the test names explicitly via the argv argument, but this seems less elegant as a programmatic API.  Moreover, this approach isn't equivalent because test names passed via argv first get passed to a _convert_names() function.

It seems like it would be a natural and simple change to enhance unittest.TestProgram() to accept not just a name but also a list of names for the defaultTest argument.  Thanks.

components: Library (Lib)
keywords: easy
messages: 163386
nosy: cjerdonek
priority: normal
severity: normal
status: open
title: Let unittest.TestProgram()'s defaultTest argument be a list
type: enhancement
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list