Exemple #1
0
 def tearDown(self):
     """Run any teardown method declared in the test class to which
     this method belongs
     """
     if self.testInstance is not None:
         names = ('teardown', 'tearDown')
         try_run(self.testInstance, names)
Exemple #2
0
 def setUp(self):
     """Run any setup function attached to the test function
     """
     if self.setUpFunc:
         self.setUpFunc()
     else:
         names = ('setup', 'setUp', 'setUpFunc')
         try_run(self.test, names)
Exemple #3
0
 def setUp(self):
     """Run any setup function attached to the test function
     """
     if self.setUpFunc:
         self.setUpFunc()
     else:
         names = ('setup', 'setUp', 'setUpFunc')
         try_run(self.test, names)
Exemple #4
0
 def tearDown(self):
     """Run any teardown function attached to the test function
     """
     if self.tearDownFunc:
         self.tearDownFunc()
     else:
         names = ('teardown', 'tearDown', 'tearDownFunc')
         try_run(self.test, names)
Exemple #5
0
 def tearDown(self):
     """Run any teardown function attached to the test function
     """
     if self.tearDownFunc:
         self.tearDownFunc()
     else:
         names = ('teardown', 'tearDown', 'tearDownFunc')
         try_run(self.test, names)
 def teardownContext(self, context):
     log.debug("%s teardown context %s", self, context)
     if self.factory:
         if context in self.factory.was_torndown:
             return
         self.factory.was_torndown[context] = self
     if isclass(context):
         names = self.classTeardown
     else:
         names = self.moduleTeardown
         if hasattr(context, '__path__'):
             names = self.packageTeardown + names
     try_run(context, names)
     self.config.plugins.stopContext(context)
Exemple #7
0
 def teardownContext(self, context):
     log.debug("%s teardown context %s", self, context)
     if self.factory:
         if context in self.factory.was_torndown:
             return
         self.factory.was_torndown[context] = self
     if isclass(context):
         names = self.classTeardown
     else:
         names = self.moduleTeardown
         if hasattr(context, '__path__'):
             names = self.packageTeardown + names
     try_run(context, names)
     self.config.plugins.stopContext(context)
Exemple #8
0
 def teardownContext(self, context):
     log.debug("%s teardown context %s", self, context)
     if self.factory:
         self.factory.was_torndown[context] = self
     if isclass(context):
         names = ('teardown_class', 'teardown_all', 'teardownClass',
                  'teardownAll', 'tearDownClass', 'tearDownAll')
     else:
         names = ('teardown_module', 'teardownModule', 'tearDownModule',
                  'teardown')
         if hasattr(context, '__path__'):
             names = ('teardown_package', 'teardownPackage',
                      'tearDownPackage') + names
     try_run(context, names)
     self.config.plugins.stopContext(context)
Exemple #9
0
 def teardownContext(self, context):
     log.debug("%s teardown context %s", self, context)
     if self.factory:
         self.factory.was_torndown[context] = self
     if isclass(context):
         names = ('teardown_class', 'teardown_all', 'teardownClass',
                  'teardownAll', 'tearDownClass', 'tearDownAll')
     else:
         names = ('teardown_module', 'teardownModule', 'tearDownModule',
                  'teardown')
         if hasattr(context, '__path__'):
             names = ('teardown_package', 'teardownPackage',
                      'tearDownPackage') + names
     try_run(context, names)
     self.config.plugins.stopContext(context)
Exemple #10
0
 def setupContext(self, context):
     self.config.plugins.startContext(context)
     log.debug("%s setup context %s", self, context)
     if self.factory:
         if context in self.factory.was_setup:
             return
         # note that I ran the setup for this context, so that I'll run
         # the teardown in my teardown
         self.factory.was_setup[context] = self
     if isclass(context):
         names = self.classSetup
     else:
         names = self.moduleSetup
         if hasattr(context, '__path__'):
             names = self.packageSetup + names
     try_run(context, names)
 def setupContext(self, context):
     self.config.plugins.startContext(context)
     log.debug("%s setup context %s", self, context)
     if self.factory:
         if context in self.factory.was_setup:
             return
         # note that I ran the setup for this context, so that I'll run
         # the teardown in my teardown
         self.factory.was_setup[context] = self
     if isclass(context):
         names = self.classSetup
     else:
         names = self.moduleSetup
         if hasattr(context, '__path__'):
             names = self.packageSetup + names
     try_run(context, names)
Exemple #12
0
 def setupContext(self, context):
     self.config.plugins.startContext(context)
     log.debug("%s setup context %s", self, context)
     if self.factory:
         # note that I ran the setup for this context, so that I'll run
         # the teardown in my teardown
         self.factory.was_setup[context] = self
     if isclass(context):
         names = ('setup_class', 'setup_all', 'setupClass', 'setupAll',
                  'setUpClass', 'setUpAll')
     else:
         names = ('setup_module', 'setupModule', 'setUpModule', 'setup')
         if hasattr(context, '__path__'):
             names = ('setup_package', 'setupPackage',
                      'setUpPackage') + names
     try_run(context, names)
Exemple #13
0
 def setupContext(self, context):
     self.config.plugins.startContext(context)
     log.debug("%s setup context %s", self, context)
     if self.factory:
         # note that I ran the setup for this context, so that I'll run
         # the teardown in my teardown
         self.factory.was_setup[context] = self
     if isclass(context):
         names = ('setup_class', 'setup_all', 'setupClass', 'setupAll',
                  'setUpClass', 'setUpAll')
     else:
         names = ('setup_module', 'setupModule', 'setUpModule', 'setup')
         if hasattr(context, '__path__'):
             names = ('setup_package', 'setupPackage',
                      'setUpPackage') + names
     try_run(context, names)
Exemple #14
0
    def tearDown(self):
        """Run any package or module teardown function found. For packages,
        teardown functions may be named 'teardownPackage',
        'teardown_package' or 'teardown'. For modules, teardown functions
        may be named 'teardownModule', 'teardown_module' or
        'teardown'. The teardown function may optionally accept a single
        argument; in that case, the test package or module will be passed
        to the teardown function.

        The teardown function will be run only if any package or module
        setup function completed successfully.
        """
        if hasattr(self.module, '__path__'):
            names = ['teardownPackage', 'teardown_package']
        else:
            names = ['teardownModule', 'teardown_module']
        names += ['tearDown', 'teardown']        
        try_run(self.module, names)
Exemple #15
0
 def setUp(self):
     """Run any package or module setup function found. For packages, setup
     functions may be named 'setupPackage', 'setup_package', 'setUp',
     or 'setup'. For modules, setup functions may be named
     'setupModule', 'setup_module', 'setUp', or 'setup'. The setup
     function may optionally accept a single argument; in that case,
     the test package or module will be passed to the setup function.
     """
     log.debug('TestModule.setUp')
     if self.module is None:
         self.module = _import(self.moduleName, [self.path], self.conf)
         log.debug('Imported %s from %s on %s', self.module,
                   self.moduleName, self.path)
     if hasattr(self.module, '__path__'):
         names = ['setupPackage', 'setUpPackage', 'setup_package']
     else:
         names = ['setupModule', 'setUpModule', 'setup_module']
     names += ['setUp', 'setup']
     try_run(self.module, names)
Exemple #16
0
 def teardownContext(self, context, result):
     log.debug("%s teardown context %s", self, context)
     if self.factory:
         if context in self.factory.was_torndown:
             return
         self.factory.was_torndown[context] = self
     if isclass(context):
         names = self.classTeardown
     else:
         names = self.moduleTeardown
         if hasattr(context, '__path__'):
             names = self.packageTeardown + names
     try:
         try_run(context, names)
     except KeyboardInterrupt:
         raise
     except:
         self.error_context = 'teardown'
         result.addError(self, self._exc_info())
     self.config.plugins.stopContext(context)
Exemple #17
0
 def tearDown(self):
     try_run(self.inst, ('teardown', 'tearDown'))
Exemple #18
0
 def setUp(self):
     try_run(self.inst, ('setup', 'setUp'))
Exemple #19
0
 def setUp(self):
     """Run any setup method declared in the test class to which this
     method belongs
     """
     names = ('setup', 'setUp')
     try_run(self.testInstance, names)
Exemple #20
0
 def setUp(self):
     try_run(self.inst, ('setup', 'setUp'))
Exemple #21
0
 def tearDown(self):
     try_run(self.inst, ('teardown', 'tearDown'))