本文整理匯總了Python中test_result.TestResult.end_in_incomplete方法的典型用法代碼示例。如果您正苦於以下問題:Python TestResult.end_in_incomplete方法的具體用法?Python TestResult.end_in_incomplete怎麽用?Python TestResult.end_in_incomplete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類test_result.TestResult
的用法示例。
在下文中一共展示了TestResult.end_in_incomplete方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __run_class_setup_fixtures
# 需要導入模塊: from test_result import TestResult [as 別名]
# 或者: from test_result.TestResult import end_in_incomplete [as 別名]
def __run_class_setup_fixtures(self):
"""Running the class's class_setup method chain."""
self._stage = self.STAGE_CLASS_SETUP
for fixture_method in self.class_setup_fixtures:
result = TestResult(fixture_method)
try:
for callback in self.__on_run_test_method_callbacks:
callback(self, fixture_method)
result.start()
if self.__execute_block_recording_exceptions(fixture_method, result, is_class_level=True):
result.end_in_success()
except (KeyboardInterrupt, SystemExit):
result.end_in_incomplete(sys.exc_info())
for callback in self.__on_complete_test_method_callbacks:
callback(self, result)
raise
else:
for callback in self.__on_complete_test_method_callbacks:
callback(self, result)
self.__run_deprecated_fixture_method('classSetUp')
示例2: __run_test_methods
# 需要導入模塊: from test_result import TestResult [as 別名]
# 或者: from test_result.TestResult import end_in_incomplete [as 別名]
def __run_test_methods(self):
"""Run this class's setup fixtures / test methods / teardown fixtures.
These are run in the obvious order - setup and teardown go before and after,
respectively, every test method. If there was a failure in the class_setup
phase, no method-level fixtures or test methods will be run, and we'll eventually
skip all the way to the class_teardown phase. If a given test method is marked
as disabled, neither it nor its fixtures will be run. If there is an exception
during during the setup phase, the test method will not be run and execution
will continue with the teardown phase.
"""
for test_method in self.runnable_test_methods():
result = TestResult(test_method)
test_method.im_self.test_result = result
try:
# run "on-run" callbacks. eg/ print out the test method name
for callback in self.__on_run_test_method_callbacks:
callback(self, test_method)
result.start()
if self.__class_level_failure:
result.end_in_failure(self.__class_level_failure)
elif self.__class_level_error:
result.end_in_error(self.__class_level_error)
else:
# first, run setup fixtures
self._stage = self.STAGE_SETUP
def _setup_block():
for fixture_method in self.setup_fixtures:
fixture_method()
self.__run_deprecated_fixture_method('setUp')
self.__execute_block_recording_exceptions(_setup_block, result)
# then run the test method itself, assuming setup was successful
self._stage = self.STAGE_TEST_METHOD
if not result.complete:
self.__execute_block_recording_exceptions(test_method, result)
# finally, run the teardown phase
self._stage = self.STAGE_TEARDOWN
def _teardown_block():
self.__run_deprecated_fixture_method('tearDown')
for fixture_method in self.teardown_fixtures:
fixture_method()
self.__execute_block_recording_exceptions(_teardown_block, result)
# if nothing's gone wrong, it's not about to start
if not result.complete:
result.end_in_success()
except (KeyboardInterrupt, SystemExit):
result.end_in_incomplete(sys.exc_info())
for callback in self.__on_complete_test_method_callbacks:
callback(self, result)
raise
else:
for callback in self.__on_complete_test_method_callbacks:
callback(self, result)
示例3: __run_deprecated_fixture_method
# 需要導入模塊: from test_result import TestResult [as 別名]
# 或者: from test_result.TestResult import end_in_incomplete [as 別名]
def __run_deprecated_fixture_method(self, fixture_name):
"""This runs an old-style (eg/ 'def setUp') fixture method."""
if hasattr(self, fixture_name):
deprecated_method = getattr(self, fixture_name)
if fixture_name.startswith('class'):
result = TestResult(deprecated_method)
try:
for callback in self.__on_run_test_method_callbacks:
callback(self, deprecated_method)
result.start()
if self.__execute_block_recording_exceptions(deprecated_method, result, is_class_level=True):
result.end_in_success()
except (KeyboardInterrupt, SystemExit):
result.end_in_incomplete(sys.exc_info())
for callback in self.__on_complete_test_method_callbacks:
callback(self, result)
raise
else:
for callback in self.__on_complete_test_method_callbacks:
callback(self, result)
else:
deprecated_method()
示例4: __run_class_teardown_fixtures
# 需要導入模塊: from test_result import TestResult [as 別名]
# 或者: from test_result.TestResult import end_in_incomplete [as 別名]
def __run_class_teardown_fixtures(self):
"""End the process of running tests. Run the class's class_teardown methods"""
self._stage = self.STAGE_CLASS_TEARDOWN
self.__run_deprecated_fixture_method('classTearDown')
for fixture_method in self.class_teardown_fixtures:
result = TestResult(fixture_method)
try:
for callback in self.__on_run_test_method_callbacks:
callback(self, fixture_method)
result.start()
if self.__execute_block_recording_exceptions(fixture_method, result, is_class_level=True):
result.end_in_success()
except (KeyboardInterrupt, SystemExit):
result.end_in_incomplete(sys.exc_info())
for callback in self.__on_complete_test_method_callbacks:
callback(self, result)
raise
else:
for callback in self.__on_complete_test_method_callbacks:
callback(self, result)