def loadTestsFromName(self, name, module=None, discovered=False):
        """Load tests from the entity with the given name.

        The name may indicate a file, directory, module, or any object
        within a module. See `nose.util.split_test_name` for details on
        test name parsing.
        """
        # FIXME refactor this method into little bites?
        log.debug("load from %s (%s)", name, module)
        
        suite = self.suiteClass

        # give plugins first crack
        plug_tests = self.config.plugins.loadTestsFromName(name, module)
        if plug_tests:
            return suite(plug_tests)
        
        addr = TestAddress(name, workingDir=self.workingDir)
        if module:
            # Two cases:
            #  name is class.foo
            #    The addr will be incorrect, since it thinks class.foo is
            #    a dotted module name. It's actually a dotted attribute
            #    name. In this case we want to use the full submitted
            #    name as the name to load from the module.
            #  name is module:class.foo
            #    The addr will be correct. The part we want is the part after
            #    the :, which is in addr.call.
            if addr.call:
                name = addr.call
            parent, obj = self.resolve(name, module)
            if (isclass(parent)
                and getattr(parent, '__module__', None) != module.__name__):
                parent = transplant_class(parent, module.__name__)
                obj = getattr(parent, obj.__name__)
            log.debug("parent %s obj %s module %s", parent, obj, module)
            if isinstance(obj, Failure):
                return suite([obj])
            else:
                return suite(ContextList([self.makeTest(obj, parent)],
                                         context=parent))
        else:
            if addr.module:
                try:
                    if addr.filename is None:
                        module = resolve_name(addr.module)
                    else:
                        self.config.plugins.beforeImport(
                            addr.filename, addr.module)
                        # FIXME: to support module.name names,
                        # do what resolve-name does and keep trying to
                        # import, popping tail of module into addr.call,
                        # until we either get an import or run out of
                        # module parts
                        try:
                            module = self.importer.importFromPath(
                                addr.filename, addr.module)
                        finally:
                            self.config.plugins.afterImport(
                                addr.filename, addr.module)
                except (KeyboardInterrupt, SystemExit):
                    raise
                except:
                    exc = sys.exc_info()
                    return suite([Failure(exc[0], exc[1], exc[2],
                                          address=addr.totuple())])
                if addr.call:
                    return self.loadTestsFromName(addr.call, module)
                else:
                    return self.loadTestsFromModule(
                        module, addr.filename,
                        discovered=discovered)
            elif addr.filename:
                path = addr.filename
                if addr.call:
                    package = getpackage(path)
                    if package is None:
                        return suite([
                            Failure(ValueError,
                                    "Can't find callable %s in file %s: "
                                    "file is not a python module" %
                                    (addr.call, path),
                                    address=addr.totuple())])
                    return self.loadTestsFromName(addr.call, module=package)
                else:
                    if op_isdir(path):
                        # In this case we *can* be lazy since we know
                        # that each module in the dir will be fully
                        # loaded before its tests are executed; we
                        # also know that we're not going to be asked
                        # to load from . and ./some_module.py *as part
                        # of this named test load*
                        return LazySuite(
                            lambda: self.loadTestsFromDir(path))
                    elif op_isfile(path):
                        return self.loadTestsFromFile(path)
                    else:
                        return suite([
                                Failure(OSError, "No such file %s" % path,
                                        address=addr.totuple())])
            else:
                # just a function? what to do? I think it can only be
                # handled when module is not None
                return suite([
                    Failure(ValueError, "Unresolvable test name %s" % name,
                            address=addr.totuple())])
def loadTestsFromName ( self , name , module = None , discovered = False ) : log . debug ( "load from %s (%s)" , name , module ) suite = self . suiteClass plug_tests = self . config . plugins . loadTestsFromName ( name , module ) if plug_tests : return suite ( plug_tests ) addr = TestAddress ( name , workingDir = self . workingDir ) if module : if addr . call : name = addr . call parent , obj = self . resolve ( name , module ) if ( isclass ( parent ) and getattr ( parent , '__module__' , None ) != module . __name__ ) : parent = transplant_class ( parent , module . __name__ ) obj = getattr ( parent , obj . __name__ ) log . debug ( "parent %s obj %s module %s" , parent , obj , module ) if isinstance ( obj , Failure ) : return suite ( [ obj ] ) else : return suite ( ContextList ( [ self . makeTest ( obj , parent ) ] , context = parent ) ) else : if addr . module : try : if addr . filename is None : module = resolve_name ( addr . module ) else : self . config . plugins . beforeImport ( addr . filename , addr . module ) try : module = self . importer . importFromPath ( addr . filename , addr . module ) finally : self . config . plugins . afterImport ( addr . filename , addr . module ) except ( KeyboardInterrupt , SystemExit ) : raise except : exc = sys . exc_info ( ) return suite ( [ Failure ( exc [ 0 ] , exc [ 1 ] , exc [ 2 ] , address = addr . totuple ( ) ) ] ) if addr . call : return self . loadTestsFromName ( addr . call , module ) else : return self . loadTestsFromModule ( module , addr . filename , discovered = discovered ) elif addr . filename : path = addr . filename if addr . call : package = getpackage ( path ) if package is None : return suite ( [ Failure ( ValueError , "Can't find callable %s in file %s: " "file is not a python module" % ( addr . call , path ) , address = addr . totuple ( ) ) ] ) return self . loadTestsFromName ( addr . call , module = package ) else : if op_isdir ( path ) : return LazySuite ( lambda : self . loadTestsFromDir ( path ) ) elif op_isfile ( path ) : return self . loadTestsFromFile ( path ) else : return suite ( [ Failure ( OSError , "No such file %s" % path , address = addr . totuple ( ) ) ] ) else : return suite ( [ Failure ( ValueError , "Unresolvable test name %s" % name , address = addr . totuple ( ) ) ] )
Load tests from the entity with the given name.

        The name may indicate a file, directory, module, or any object
        within a module. See `nose.util.split_test_name` for details on
        test name parsing.