import unittest


def parameterize(test_case_class, *args, **kwargs):
    """Create a suite containing all tests taken from the given
    subclass, passing them the parameters.

    .. code-block:: python

        class TestParameterizedCase(unittest.TestCase):
            def __init__(self, methodName='runTest', foo=None):
                unittest.TestCase.__init__(self, methodName)
                self.foo = foo

        def suite():
            testSuite = unittest.TestSuite()
            testSuite.addTest(parameterize(TestParameterizedCase, foo=10))
            testSuite.addTest(parameterize(TestParameterizedCase, foo=50))
            return testSuite
    """
    test_loader = unittest.TestLoader()
    test_names = test_loader.getTestCaseNames(test_case_class)
    suite = unittest.TestSuite()
    for name in test_names:
        suite.addTest(test_case_class(name, *args, **kwargs))
    return suite