Passing arguments to subclasses of unittest.TestCase

T

Tom Harris

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.
 
D

Diez B. Roggisch

Tom said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top