[issue12600] Support parameterized TestCases in unittest

Michael Foord report at bugs.python.org
Sat Jul 23 20:10:00 CEST 2011


Michael Foord <michael at voidspace.org.uk> added the comment:

Having a "TestCase factory" would be pretty easy, and solve the scaling problems.

For example:

def make_testcase_classes():
    for backend in backends:
        yield type(
            '{}Test'.format(backend.name),
            (TheBaseClass, unittest.TestCase),
            {'backend': backend}
        )

You would use this in the load_tests function at the module level to generate all the test cases.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12600>
_______________________________________


More information about the Python-bugs-list mailing list