Created
March 8, 2017 15:07
-
-
Save slaykovsky/2eeab05c173bd6d5d1092c6a26512625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from sys import modules | |
class Base(object): | |
test_case = None | |
@classmethod | |
def __new__(cls, *args, **kwargs): | |
cls.test_case = cls.__name__[-4:] | |
return object.__new__(cls) | |
class BaseTest(Base): | |
def test_something(self): | |
assert self.test_case == self.__class__.__name__[-4:] | |
meta_class = BaseTest | |
for i in range(10000): | |
clazz_name = "Test_{0:04d}".format(i) | |
clazz = type(clazz_name, (meta_class,), dict()) | |
setattr(modules[meta_class.__module__], clazz.__name__, clazz) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment