def loadTestsFromName(self, name, module=None):
parts = name.split('<STR_LIT:.>')<EOL>if module is None:<EOL><INDENT>parts_copy = parts[:]<EOL>while parts_copy:<EOL><INDENT>try:<EOL><INDENT>module = __import__('<STR_LIT:.>'.join(parts_copy))<EOL>break<EOL><DEDENT>except ImportError:<EOL><INDENT>del parts_copy[-<NUM_LIT:1>]<EOL>if not parts_copy:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>parts = parts[<NUM_LIT:1>:]<EOL><DEDENT>obj = module<EOL>for part in parts:<EOL><INDENT>parent, obj = obj, getattr(obj, part)<EOL><DEDENT>if isinstance(obj, types.ModuleType):<EOL><INDENT>return self.loadTestsFromModule(obj)<EOL><DEDENT>elif isinstance(obj, type) and issubclass(obj, unittest.TestCase):<EOL><INDENT>return self.loadTestsFromTestCase(obj)<EOL><DEDENT>elif (isinstance(obj, types.UnboundMethodType) and<EOL>isinstance(parent, type) and<EOL>issubclass(parent, case.TestCase)):<EOL><INDENT>return self.suiteClass([parent(obj.__name__)])<EOL><DEDENT>elif isinstance(obj, unittest.TestSuite):<EOL><INDENT>return obj<EOL><DEDENT>elif hasattr(obj, '<STR_LIT>'):<EOL><INDENT>test = obj()<EOL>if isinstance(test, unittest.TestSuite):<EOL><INDENT>return test<EOL><DEDENT>elif isinstance(test, unittest.TestCase):<EOL><INDENT>return self.suiteClass([test])<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" %<EOL>(obj, test))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" % obj)<EOL><DEDENT>
Return a suite of all tests cases given a string specifier.

        The name may resolve either to a module, a test case class, a
        test method within a test case class, or a callable object which
        returns a TestCase or TestSuite instance.

        The method optionally resolves the names relative to a given module.