def __new__(meta, name, bases, attrs): with open(CONFIG_PATH) as f: config = json.load(f) for test in config['tests']: input_name = test['input'] attr_name = 'test_' + SLUGIFY_PATTERN.sub( '_', os.path.splitext(input_name)[0].lower(), ) func = _make_test(test) func.__doc__ = input_name if test.get('skip', False): func = unittest.skip(input_name)(func) if test.get('fail', False): func = unittest.expectsFailure(func) attrs[attr_name] = func return type.__new__(meta, name, bases, attrs)