本文整理汇总了Python中testtools.RunTest.run方法的典型用法代码示例。如果您正苦于以下问题:Python RunTest.run方法的具体用法?Python RunTest.run怎么用?Python RunTest.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testtools.RunTest
的用法示例。
在下文中一共展示了RunTest.run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__run_core_called
# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import run [as 别名]
def test__run_core_called(self):
case = self.make_case()
log = []
run = RunTest(case, lambda x: x)
run._run_core = lambda: log.append('foo')
run.run()
self.assertEqual(['foo'], log)
示例2: test__run_prepared_result_calls_start_and_stop_test
# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import run [as 别名]
def test__run_prepared_result_calls_start_and_stop_test(self):
result = ExtendedTestResult()
case = self.make_case()
run = RunTest(case, lambda x: x)
run.run(result)
self.assertEqual([
('startTest', case),
('addSuccess', case),
('stopTest', case),
], result._events)
示例3: test_run_with_result
# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import run [as 别名]
def test_run_with_result(self):
# test.run passes result down to _run_test_method.
log = []
class Case(TestCase):
def _run_test_method(self, result):
log.append(result)
case = Case('_run_test_method')
run = RunTest(case, lambda x: log.append(x))
result = TestResult()
run.run(result)
self.assertEqual(1, len(log))
self.assertEqual(result, log[0].decorated)
示例4: test__run_prepared_result_calls_stop_test_always
# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import run [as 别名]
def test__run_prepared_result_calls_stop_test_always(self):
result = ExtendedTestResult()
case = self.make_case()
def inner():
raise Exception("foo")
run = RunTest(case, lambda x: x)
run._run_core = inner
self.assertThat(lambda: run.run(result),
Raises(MatchesException(Exception("foo"))))
self.assertEqual([
('startTest', case),
('stopTest', case),
], result._events)
示例5: test_run_no_result_manages_new_result
# 需要导入模块: from testtools import RunTest [as 别名]
# 或者: from testtools.RunTest import run [as 别名]
def test_run_no_result_manages_new_result(self):
log = []
run = RunTest(self.make_case(), lambda x: log.append(x) or x)
result = run.run()
self.assertIsInstance(result.decorated, TestResult)