当前位置: 首页>>代码示例>>Python>>正文


Python RunTest._run_prepared_result方法代码示例

本文整理汇总了Python中testtools.RunTest._run_prepared_result方法的典型用法代码示例。如果您正苦于以下问题:Python RunTest._run_prepared_result方法的具体用法?Python RunTest._run_prepared_result怎么用?Python RunTest._run_prepared_result使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testtools.RunTest的用法示例。


在下文中一共展示了RunTest._run_prepared_result方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test__run_prepared_result_does_not_mask_keyboard

# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import _run_prepared_result [as 别名]
 def test__run_prepared_result_does_not_mask_keyboard(self):
     class Case(TestCase):
         def test(self):
             raise KeyboardInterrupt("go")
     case = Case('test')
     run = RunTest(case)
     run.result = ExtendedTestResult()
     self.assertThat(lambda: run._run_prepared_result(run.result),
         Raises(MatchesException(KeyboardInterrupt)))
     self.assertEqual(
         [('startTest', case), ('stopTest', case)], run.result._events)
     # tearDown is still run though!
     self.assertEqual(True, getattr(case, '_TestCase__teardown_called'))
开发者ID:ClusterHQ,项目名称:testtools,代码行数:15,代码来源:test_runtest.py

示例2: test__run_prepared_result_uncaught_Exception_raised

# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import _run_prepared_result [as 别名]
 def test__run_prepared_result_uncaught_Exception_raised(self):
     e = KeyError('Yo')
     class Case(TestCase):
         def test(self):
             raise e
     case = Case('test')
     log = []
     def log_exc(self, result, err):
         log.append((result, err))
     run = RunTest(case, [(ValueError, log_exc)])
     run.result = ExtendedTestResult()
     self.assertThat(lambda: run._run_prepared_result(run.result),
         Raises(MatchesException(KeyError)))
     self.assertEqual(
         [('startTest', case), ('stopTest', case)], run.result._events)
     self.assertEqual([], log)
开发者ID:allenap,项目名称:testtools,代码行数:18,代码来源:test_runtest.py

示例3: test__run_prepared_result_does_not_mask_keyboard

# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import _run_prepared_result [as 别名]
 def test__run_prepared_result_does_not_mask_keyboard(self):
     tearDownRuns = []
     class Case(TestCase):
         def test(self):
             raise KeyboardInterrupt("go")
         def _run_teardown(self, result):
             tearDownRuns.append(self)
             return super(Case, self)._run_teardown(result)
     case = Case('test')
     run = RunTest(case)
     run.result = ExtendedTestResult()
     self.assertThat(lambda: run._run_prepared_result(run.result),
         Raises(MatchesException(KeyboardInterrupt)))
     self.assertEqual(
         [('startTest', case), ('stopTest', case)], run.result._events)
     # tearDown is still run though!
     self.assertThat(tearDownRuns, HasLength(1))
开发者ID:allenap,项目名称:testtools,代码行数:19,代码来源:test_runtest.py

示例4: test__run_prepared_result_uncaught_Exception_triggers_error

# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import _run_prepared_result [as 别名]
 def test__run_prepared_result_uncaught_Exception_triggers_error(self):
     # https://bugs.launchpad.net/testtools/+bug/1364188
     # When something isn't handled, the test that was
     # executing has errored, one way or another.
     e = SystemExit(0)
     class Case(TestCase):
         def test(self):
             raise e
     case = Case('test')
     log = []
     def log_exc(self, result, err):
         log.append((result, err))
     run = RunTest(case, [], log_exc)
     run.result = ExtendedTestResult()
     self.assertThat(lambda: run._run_prepared_result(run.result),
         Raises(MatchesException(SystemExit)))
     self.assertEqual(
         [('startTest', case), ('stopTest', case)], run.result._events)
     self.assertEqual([(run.result, e)], log)
开发者ID:allenap,项目名称:testtools,代码行数:21,代码来源:test_runtest.py


注:本文中的testtools.RunTest._run_prepared_result方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。