'Run tests from unittest.TestCase-derived classes.'

def _run_unittest(self, result, *classes):

    valid_types = (unittest.TestSuite, unittest.TestCase)
    suite = unittest.TestSuite()
    for cls in classes:
        if isinstance(cls, str):
            if (cls in sys.modules):
                suite.addTest(unittest.findTestCases(sys.modules[cls]))
            else:
                raise ValueError('str    arguments    must    be    keys    in    sys.modules')
        elif isinstance(cls, valid_types):
            suite.addTest(cls)
        else:
            suite.addTest(unittest.makeSuite(cls))
    suite.run(result)
