Пример #1
0
 def _inLayer(self, layer, test, method):
     meth = self._getBoundClassmethod(layer, method)
     if meth:
         if util.num_expected_args(meth) > 1:
             meth(test)
         else:
             meth()
Пример #2
0
 def _inLayer(self, layer, test, method):
     meth = self._getBoundClassmethod(layer, method)
     if meth:
         if util.num_expected_args(meth) > 1:
             meth(test)
         else:
             meth()
Пример #3
0
    def loadTestsFromName(self, event):
        """Load test if event.name is the name of a test function"""
        name = event.name
        module = event.module
        try:
            result = util.test_from_name(name, module)
        except (AttributeError, ImportError):
            event.handled = True
            return event.loader.failedLoadTests(name, sys.exc_info())
        if result is None:
            return

        parent, obj, name, index = result
        if (isinstance(obj, types.FunctionType) and not util.isgenerator(obj)
                and not hasattr(obj, 'paramList')
                and util.num_expected_args(obj) == 0):
            suite = event.loader.suiteClass()
            suite.addTests(self._createTests(obj))
            event.handled = True
            return suite
Пример #4
0
    def loadTestsFromName(self, event):
        """Load test if event.name is the name of a test function"""
        name = event.name
        module = event.module
        try:
            result = util.test_from_name(name, module)
        except (AttributeError, ImportError):
            event.handled = True
            return event.loader.failedLoadTests(name, sys.exc_info())
        if result is None:
            return

        parent, obj, name, index = result
        if (isinstance(obj, types.FunctionType) and not
            util.isgenerator(obj) and not
            hasattr(obj, 'paramList') and
            util.num_expected_args(obj) == 0):
            suite = event.loader.suiteClass()
            suite.addTests(self._createTests(obj))
            event.handled = True
            return suite
Пример #5
0
 def is_test(obj):
     if not obj.__name__.startswith(self.session.testMethodPrefix):
         return False
     if util.num_expected_args(obj) > 0:
         return False
     return True
Пример #6
0
 def is_test(obj):
     if not obj.__name__.startswith(self.session.testMethodPrefix):
         return False
     if util.num_expected_args(obj) > 0:
         return False
     return True