summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_atexit.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-09-23 20:43:09 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-09-23 20:43:09 (GMT)
commita74d675facda18cca2a821be56d49446184b6ea1 (patch)
treebca9303397115409c11dee8fc2e1a104e232b333 /Lib/test/test_atexit.py
parent5cd5f12a48d243d447b58558aa5f9080038a827c (diff)
downloadcpython-a74d675facda18cca2a821be56d49446184b6ea1.zip
cpython-a74d675facda18cca2a821be56d49446184b6ea1.tar.gz
cpython-a74d675facda18cca2a821be56d49446184b6ea1.tar.bz2
backport the atexit test for r66563
Diffstat (limited to 'Lib/test/test_atexit.py')
-rw-r--r--Lib/test/test_atexit.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py
index bea482f..a60dfa8 100644
--- a/Lib/test/test_atexit.py
+++ b/Lib/test/test_atexit.py
@@ -22,6 +22,19 @@ class TestCase(unittest.TestCase):
atexit._exithandlers = save_handlers
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):
# be sure handlers are executed in reverse order
s = StringIO.StringIO()