Message 43714 - Python tracker (original) (raw)

Logged In: YES user_id=89016

But this can be solved with a special non-inheritable class attribute:

class BaseTest(unittest.TestCase): run = False

Then the metaclass can do the following: def new(cls, name, bases, dict): if "run" not in dict: dict["run"] = True cls = type.new(cls, name, bases, dict) if cls.run: tests.append(cls) return cls