本文整理匯總了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()