Dynamically passing variables to unittest

Mark McEahern marklists at mceahern.com
Tue Dec 14 22:06:08 EST 2004


Tom Haddon wrote:

>Hi Folks,
>
>Newbie question here. I'm trying to set up some unit testing for a database abstraction class, and the first thing I want to test is the connection parameters. So, my question is, how do I dynamically pass the variables from a list, for example to the unittest module so I can maintain the list of test cases more easily:
>  
>
 >>> def func(*args):
...     for a in args:
...             print a
...
 >>> vars = range(10)
 >>> func(*vars)
0
1
2
3
4
5
6
7
8
9
 >>>

// m



More information about the Python-list mailing list