summaryrefslogtreecommitdiff
path: root/Lib/test/test_atexit.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-05-07 18:15:34 +0300
committerEzio Melotti <ezio.melotti@gmail.com>2011-05-07 18:15:34 +0300
commit17736f19671fe9e3a1d0965abf6e0d022c3c7b7f (patch)
tree53cdecfea95a81b6ef7326980cf5e81328b32b06 /Lib/test/test_atexit.py
parent2c515bbdb8fc7fd4cc3d01151d0b8dd8d5adccfd (diff)
parent496564fe5be17057671a373f4a1126352823ece5 (diff)
downloadcpython-17736f19671fe9e3a1d0965abf6e0d022c3c7b7f.tar.gz
#12017: merge with 3.1.
Diffstat (limited to 'Lib/test/test_atexit.py')
-rw-r--r--Lib/test/test_atexit.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py
index 8a71036fde..5200af7ed9 100644
--- a/Lib/test/test_atexit.py
+++ b/Lib/test/test_atexit.py
@@ -25,8 +25,9 @@ def raise2():
class TestCase(unittest.TestCase):
def setUp(self):
+ self.save_stdout = sys.stdout
+ self.save_stderr = sys.stderr
self.stream = io.StringIO()
- self.save_stdout, self.save_stderr = sys.stderr, sys.stdout
sys.stdout = sys.stderr = self.stream
atexit._clear()
@@ -65,6 +66,14 @@ class TestCase(unittest.TestCase):
self.assertRaises(TypeError, atexit._run_exitfuncs)
+ def test_raise_unnormalized(self):
+ # Issue #10756: Make sure that an unnormalized exception is
+ # handled properly
+ atexit.register(lambda: 1 / 0)
+
+ self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs)
+ self.assertIn("ZeroDivisionError", self.stream.getvalue())
+
def test_stress(self):
a = [0]
def inc():