I have a list of twelve properties and want to test various combinations. The actual test function is the same, just different parameters. I find myself writing a bunch of functions that look like this:
def test_paramA(self): self.with_params("A")
def test_paramA_B(self): self.with_params("A+B")
def test_paramA_C(self): self.with_params("A+C")
def test_paramB_C(self): self.with_params("B+C")
I'd like to instead write this:
combinations = ["A", "A+B", "A+C", "B+C"]
combinationSuite = (make_test_function(c) for c in combinations)
Is there any way to make my test driver (nosetests) run all the tests in combinationSuite? Do I need a custom test collector?