pyt/path.py
def method_names(self):
        """return the actual test methods that matched self.method_name"""
        for c in self.classes():
            #ms = inspect.getmembers(c, inspect.ismethod)
            # http://stackoverflow.com/questions/17019949/
            ms = inspect.getmembers(c, lambda f: inspect.ismethod(f) or inspect.isfunction(f))
            method_name = getattr(self, 'method_name', '')
            method_regex = ''
            if method_name:
                if method_name.startswith(self.method_prefix):
                    method_regex = re.compile(r'^{}'.format(method_name), flags=re.I)

                else:

                    if method_name.startswith("*"):
                        method_name = method_name.strip("*")
                        method_regex = re.compile(
                            r'^{}[_]{{0,1}}.*?{}'.format(self.method_prefix, method_name),
                            flags=re.I
                        )
                    else:
                        method_regex = re.compile(
                            r'^{}[_]{{0,1}}{}'.format(self.method_prefix, method_name),
                            flags=re.I
                        )

            for m_name, m in ms:
                if not m_name.startswith(self.method_prefix): continue

                can_yield = True
                if method_regex and not method_regex.match(m_name):
                    can_yield = False

                if can_yield:
                    logger.debug('method: {} matches {}'.format(m_name, method_name))
                    yield c, m_name
def method_names(self):
        for c in self.classes():
            #ms = inspect.getmembers(c, inspect.ismethod)
            # http://stackoverflow.com/questions/17019949/
            ms = inspect.getmembers(c, lambda f: inspect.ismethod(f) or inspect.isfunction(f))
            method_name = getattr(self, 'method_name', '')
            method_regex = ''
            if method_name:
                if method_name.startswith(self.method_prefix):
                    method_regex = re.compile(r'^{}'.format(method_name), flags=re.I)

                else:

                    if method_name.startswith("*"):
                        method_name = method_name.strip("*")
                        method_regex = re.compile(
                            r'^{}[_]{{0,1}}.*?{}'.format(self.method_prefix, method_name),
                            flags=re.I
                        )
                    else:
                        method_regex = re.compile(
                            r'^{}[_]{{0,1}}{}'.format(self.method_prefix, method_name),
                            flags=re.I
                        )

            for m_name, m in ms:
                if not m_name.startswith(self.method_prefix): continue

                can_yield = True
                if method_regex and not method_regex.match(m_name):
                    can_yield = False

                if can_yield:
                    logger.debug('method: {} matches {}'.format(m_name, method_name))
                    yield c, m_name
def method_names ( self ) : for c in self . classes ( ) : #ms = inspect.getmembers(c, inspect.ismethod) # http://stackoverflow.com/questions/17019949/ ms = inspect . getmembers ( c , lambda f : inspect . ismethod ( f ) or inspect . isfunction ( f ) ) method_name = getattr ( self , 'method_name' , '' ) method_regex = '' if method_name : if method_name . startswith ( self . method_prefix ) : method_regex = re . compile ( r'^{}' . format ( method_name ) , flags = re . I ) else : if method_name . startswith ( "*" ) : method_name = method_name . strip ( "*" ) method_regex = re . compile ( r'^{}[_]{{0,1}}.*?{}' . format ( self . method_prefix , method_name ) , flags = re . I ) else : method_regex = re . compile ( r'^{}[_]{{0,1}}{}' . format ( self . method_prefix , method_name ) , flags = re . I ) for m_name , m in ms : if not m_name . startswith ( self . method_prefix ) : continue can_yield = True if method_regex and not method_regex . match ( m_name ) : can_yield = False if can_yield : logger . debug ( 'method: {} matches {}' . format ( m_name , method_name ) ) yield c , m_name
return the actual test methods that matched self.method_name
return the actual test methods that matched self . method_name