Nick Coghlan <ncogh...@gmail.com> added the comment: Here's a sketch for a possible decorator factory:
def parameters(params, *, builder=_default_param_builder): def make_parameterized_test(f): return ParameterizedTest(f, params, builder) return make_parameterized_test (default builder would be the one I sketched earlier) Example usage: ExampleParams = namedtuple('ExampleParams', 'x y') all_cases = [ExampleParams(x, y) for x in range(3) for y in range(3)] def x_y_naming(name, cases): for idx, case in enumerate(cases, start=1): x, y = case yield ("{}_{}_{}_{}".format(name, idx, x, y), case) class ExampleTestCase(TestCase): @parameters(all_cases) def test_example_auto_naming(self, x, y): self.assertNotEqual(x, y) # fails sometimes :) @parameters(all_cases, builder=x_y_naming) def test_example_custom_naming(self, x, y): self.assertNotEqual(x, y) # fails sometimes :) Once defined, you're far better equipped than I am to decide how TestLoader and TestCase can best cooperate to generate appropriate test operations and error messages. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7897> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com