I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this:
import unittest
l = [[\"foo\", \"a\", \"a\
You can use nose-ittr plugin (pip install nose-ittr
).
It's very easy to integrate with existing tests, minimal changes (if any) are required. It also supports nose multiprocessing plugin.
Not that you can also have a customize setup
function per test.
@ittr(number=[1, 2, 3, 4])
def test_even(self):
assert_equal(self.number % 2, 0)
It is also possible to pass nosetest
parameters like with their build-in plugin attrib
, this way you can run only a specific test with specific parameter:
nosetest -a number=2