[ python-Bugs-1078905 ] Docs for run() methods are misleading

SourceForge.net noreply at sourceforge.net
Sat Dec 4 15:42:38 CET 2004


Bugs item #1078905, was opened at 2004-12-04 14:42
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1078905&group_id=5470

Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Kent Johnson (kjohnson)
Assigned to: Nobody/Anonymous (nobody)
Summary: Docs for run() methods are misleading

Initial Comment:
In the unittest module, the methods TestCase.run() and
TestSuite.run() are not very useful and the
documentation for them is misleading. I'm not sure
whether to call this a problem with the docs or the
code, but I think the easiest fix is to change the docs. 

>From the documentation, you would think that to
specialize the way a TestCase or TestSuite is run, you
should override the run() methods. For example, you
might try this:

<see attachment>

The output from this program is just 

My test

The problem is that the run() methods are never used by
the rest of the framework. In both cases, run() is
equivalent to __call__(), and it is __call__() that is
actually used by the rest of the framework. To get the
expected output, change 'run' to '__call__' in four
places, then you will see this:

Suite start
MyTests run
My test
Suite end

I suggest that, at a minimum, the documentation should
be changed to refer to __call__() instead of run for
these two classes. Possibly the code should be changed
to either get rid of run() or actually use it, but I'm
not so sure this can be done without breaking existing
usage. 



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

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


More information about the Python-bugs-list mailing list