Passing arguments to subclasses of unittest.TestCase

Diez B. Roggisch deets at nospam.web.de
Tue Nov 27 16:04:29 EST 2007


Tom Harris schrieb:
> Hi,
> 
> Is there a way to pass arguments to TestCases when running tests? I have 
> a test suite that need to be configured slightly differently for 3 
> different products, and rather than do a hack I wondered if there was a 
> canonical way to do it.
> 
> I _know_ that py.test can do it trivially. I am rather stuck with 
> unittest, as I have 84 testcases, and I have to make it work tomorrow.

How about writing one test that takes arguments, and three test-methods 
that invoke it with different arguments? Or need there be commandline 
arguments or such stuff involved?

Diez



More information about the Python-list mailing list