def testRemoveHandler(self): default_handler = signal.getsignal(signal.SIGINT) unittest.installHandler() unittest.removeHandler() self.assertEqual(signal.getsignal(signal.SIGINT), default_handler) unittest.removeHandler() self.assertEqual(signal.getsignal(signal.SIGINT), default_handler)
def run_tests(file): suite = get_tests_suite(file) unittest.installHandler() logging.disable(logging.INFO) results = unittest.TextTestRunner(verbosity=2).run(suite) logging.disable(logging.NOTSET) unittest.removeHandler() return results
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)
def teardown_test_environment(self, **kwargs): unittest.removeHandler() teardown_test_environment()
import collections
def deinit(self): unittest.removeHandler()