[TIP] Using one unit test with different input parameters

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Feb 19 16:12:05 PST 2008

[Robert and Johnathon, please don't send me copies of messages also
sent to the list. Follow-up just to the list is fine.]

"Jonathan Lange" <jml at mumak.net> writes:

> On Feb 20, 2008 10:31 AM, Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:
> > Robert Collins <robertc at robertcollins.net> writes:
> >
> > > You might like to look at bzrlib.tests.TestScenarioApplier. In
> > > combination with bzrlib.tests.TestUtil.TestLoader, which extends
> > > unittests TestLoader, you can very easily parameterise some
> > > tests in a test script while preserving others.
> >
> > Looks interesting. How does the above code work with the extended
> > TestLoader
> > <URL:http://www.python.org/doc/lib/testloader-objects.html> class?
> You have to use the bzrlib TestLoader, which inherits from the
> standard library's TestLoader.
> Also, I'm not sure exactly what you mean by "extended" here.

I'm using the term Robert Collins used above; he says the bzrlib
TestLoader "extends unittest's TestLoader".

My question was asking how the example code Robert gave relates to a
TestLoader. All I see in his example is a 'load_tests' function; is
that supposed to be defined on a class that I write in my unit test
suite? Am I supposed to extend bzrlib's TestLoader?

If there's documentation online for this, please feel free to point me
to that.

 \               "I was sleeping the other night, alone, thanks to the |
  `\                                    exterminator."  -- Emo Philips |
_o__)                                                                  |
Ben Finney

More information about the testing-in-python mailing list