[Patches] [ python-Patches-787789 ] unittest.py: Custom TestRunners and --verbose

SourceForge.net noreply at sourceforge.net
Tue Aug 12 21:31:35 EDT 2003


Patches item #787789, was opened at 2003-08-12 22:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=787789&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthew F. Barnes (mfbarnes)
Assigned to: Nobody/Anonymous (nobody)
Summary: unittest.py: Custom TestRunners and --verbose

Initial Comment:
The unittest.TestProgram class accepts a "--verbose"
command-line argument.  But the setting only gets
applied if the testRunner argument to
unittest.TestProgram.__init__ is None.  There is no
clean way of creating a custom TestRunner class and
passing it to unittest.TestProgram such that the
correct verbosity is picked up.

This patch slightly alters the interface to
unittest.TestProgram.__init__ by allowing a class to be
passed as the testRunner argument (defaulting to
TextTestRunner instead of None).  Then the runTests
method of unittest.TestProgram checks whether
self.testRunner is a class, and if so creates an
instance of it, passing the correct verbosity setting
to the TestRunner class' __init__ method.

The patch should still allow a custom TestRunner class
_instance_ to be passed to unittest.TestProgram.__init__.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=787789&group_id=5470



More information about the Patches mailing list