本文整理汇总了Python中testtools.testcase.TestCase方法的典型用法代码示例。如果您正苦于以下问题:Python testcase.TestCase方法的具体用法?Python testcase.TestCase怎么用?Python testcase.TestCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testtools.testcase
的用法示例。
在下文中一共展示了testcase.TestCase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
# 需要导入模块: from testtools import testcase [as 别名]
# 或者: from testtools.testcase import TestCase [as 别名]
def tearDown(self):
self.index.disconnect()
self.coord.stop()
super(TestCase, self).tearDown()
示例2: setUp
# 需要导入模块: from testtools import testcase [as 别名]
# 或者: from testtools.testcase import TestCase [as 别名]
def setUp(self):
super(TestCase, self).setUp()
self.loop = asyncio.new_event_loop()
self.addCleanup(self.loop.close)
asyncio.set_event_loop(self.loop)
示例3: patch
# 需要导入模块: from testtools import testcase [as 别名]
# 或者: from testtools.testcase import TestCase [as 别名]
def patch(self, obj, attribute, value=mock.sentinel.unset):
"""Patch `obj.attribute` with `value`.
If `value` is unspecified, a new `Mock` will be created and patched-in
instead. Its ``__name__`` attribute will be set to `attribute`.
This is a thin customisation of `testtools.TestCase.patch`, so refer
to that in case of doubt.
:return: The patched-in object.
"""
if value is mock.sentinel.unset:
value = mock.Mock(__name__=attribute)
super(TestCase, self).patch(obj, attribute, value)
return value
示例4: __init__
# 需要导入模块: from testtools import testcase [as 别名]
# 或者: from testtools.testcase import TestCase [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# testtools' assertRaises predates unittest's which has
# support for context-manager
self.assertRaises = super(TestCase, self).assertRaises
示例5: setUp
# 需要导入模块: from testtools import testcase [as 别名]
# 或者: from testtools.testcase import TestCase [as 别名]
def setUp(self):
self.assertEqual = super(TestCase, self).assertEqual
super().setUp()
self.beginTransaction()
self.addCleanup(self.endTransaction)
self.setUpFixtures()