nose, unittest.TestCase and metaclass: auto-generated test_* methods not discovered
问题 This is a follow-up question for unittest and metaclass: automatic test_* method generation: For this (fixed) unittest.TestCase layout: #!/usr/bin/env python import unittest class TestMaker(type): def __new__(cls, name, bases, attrs): callables = dict([ (meth_name, meth) for (meth_name, meth) in attrs.items() if meth_name.startswith('_test') ]) for meth_name, meth in callables.items(): assert callable(meth) _, _, testname = meth_name.partition('_test') # inject methods: test{testname}_v4,6