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