本文整理汇总了Python中unittest.removeHandler方法的典型用法代码示例。如果您正苦于以下问题:Python unittest.removeHandler方法的具体用法?Python unittest.removeHandler怎么用?Python unittest.removeHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest
的用法示例。
在下文中一共展示了unittest.removeHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRemoveHandler
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import removeHandler [as 别名]
def testRemoveHandler(self):
default_handler = signal.getsignal(signal.SIGINT)
unittest.installHandler()
unittest.removeHandler()
self.assertEqual(signal.getsignal(signal.SIGINT), default_handler)
# check that calling removeHandler multiple times has no ill-effect
unittest.removeHandler()
self.assertEqual(signal.getsignal(signal.SIGINT), default_handler)
示例2: testRemoveHandlerAsDecorator
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import removeHandler [as 别名]
def testRemoveHandlerAsDecorator(self):
default_handler = signal.getsignal(signal.SIGINT)
unittest.installHandler()
@unittest.removeHandler
def test():
self.assertEqual(signal.getsignal(signal.SIGINT), default_handler)
test()
self.assertNotEqual(signal.getsignal(signal.SIGINT), default_handler)
示例3: stopTest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import removeHandler [as 别名]
def stopTest(self, test):
super(DebugSQLTextTestResult, self).stopTest(test)
self.logger.removeHandler(self.handler)
if self.showAll:
self.debug_sql_stream.seek(0)
self.stream.write(self.debug_sql_stream.read())
self.stream.writeln(self.separator2)
示例4: teardown_test_environment
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import removeHandler [as 别名]
def teardown_test_environment(self, **kwargs):
unittest.removeHandler()
teardown_test_environment()
示例5: stopTest
# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import removeHandler [as 别名]
def stopTest(self, test):
super().stopTest(test)
self.logger.removeHandler(self.handler)
if self.showAll:
self.debug_sql_stream.seek(0)
self.stream.write(self.debug_sql_stream.read())
self.stream.writeln(self.separator2)