Kaydet (Commit) a74d675f authored tarafından Benjamin Peterson's avatar Benjamin Peterson

backport the atexit test for r66563

üst 5cd5f12a
...@@ -22,6 +22,19 @@ class TestCase(unittest.TestCase): ...@@ -22,6 +22,19 @@ class TestCase(unittest.TestCase):
atexit._exithandlers = save_handlers atexit._exithandlers = save_handlers
self.assertEqual(s.getvalue(), "h4 (4,) {'kw': 'abc'}\nh4 () {}\nh1\n") self.assertEqual(s.getvalue(), "h4 (4,) {'kw': 'abc'}\nh4 () {}\nh1\n")
def test_badargs(self):
s = StringIO.StringIO()
sys.stdout = sys.stderr = s
save_handlers = atexit._exithandlers
atexit._exithandlers = []
try:
atexit.register(lambda: 1, 0, 0, (x for x in (1,2)), 0, 0)
self.assertRaises(TypeError, atexit._run_exitfuncs)
finally:
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
atexit._exithandlers = save_handlers
def test_order(self): def test_order(self):
# be sure handlers are executed in reverse order # be sure handlers are executed in reverse order
s = StringIO.StringIO() s = StringIO.StringIO()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment