Пример #1
0
 def test(self, test_paths, argv=[], smoke=False):
     '''
     :param test_paths: iterable like ['package.module.test_class.test_method', ...]
     '''
     results = TestResults()
     if smoke or not test_paths:
         self.log.i('Ignoring %r \n  (smoke mode or no tests found)' %
                    list(test_paths))
         return results
     level_mngr = WebdriverManager().enter_level(level=TEST_ROUND_LIFE)
     for tpath in test_paths:
         class_ = self._import_test(tpath)
         if isinstance(class_, TestException):
             results.append_result(tpath, class_)
         else:
             result = self._run_test(tpath, argv, class_)
             results.append_result(tpath, result)
     level_mngr.exit_level()
     return results
Пример #2
0
 def test(self, test_paths, argv=[], smoke=False):
     '''
     :param test_paths: iterable like ['package.module.test_class.test_method', ...]
     '''
     results = TestResults()
     if smoke or not test_paths:
         self.log.i('Ignoring %r \n  (smoke mode or no tests found)' %
                    list(test_paths))
         return results
     level_mngr = WebdriverManager().enter_level(level=TEST_ROUND_LIFE)
     for tpath in test_paths:
         class_ = self._import_test(tpath)
         if isinstance(class_, TestException):
             results.append_result(tpath, class_)
         else:
             result = self._run_test(tpath, argv, class_)
             results.append_result(tpath, result)
     level_mngr.exit_level()
     return results
Пример #3
0
 def _run_tests(self, test_paths, argv=None, one_process=False):
     results = TestResults()
     tests = {}
     for tpath in test_paths:
         try:
             tests[tpath] = self._get_test_suite(tpath, argv)
         except Exception as e:
             results.append_result(tpath, self.reprex(e))
     result = unittest.TestResult()
     if one_process:
         suite = unittest.TestSuite(tests.values())
         self._prepare_and_run(TestsContainer(suite, result), one_process)
         results.append_result('all', result)
     else:
         for tpath, tst in tests.iteritems():
             tst = TestsContainer(tpath, argv=argv)
             if not is_pickable(tst):
                 self.log.e('Cannot pickle %r. Won\'t test it' % tst)
                 continue
             r = self._prepare_and_run(tst, one_process)
             results.append_result(tpath, r)
     return results
Пример #4
0
 def _run_tests(self, test_paths, argv=None, one_process=False):
     results = TestResults()
     tests = {}
     for tpath in test_paths:
         try:
             tests[tpath] = self._get_test_suite(tpath, argv)
         except Exception as e:
             results.append_result(tpath, self.reprex(e))
     result = unittest.TestResult()
     if one_process:
         suite = unittest.TestSuite(tests.values())
         self._prepare_and_run(TestsContainer(suite, result), one_process)
         results.append_result('all', result)
     else:
         for tpath, tst in tests.iteritems():
             tst = TestsContainer(tpath, argv=argv)
             if not is_pickable(tst):
                 self.log.e('Cannot pickle %r. Won\'t test it' % tst)
                 continue
             r = self._prepare_and_run(tst, one_process)
             results.append_result(tpath, r)
     return results