[Python-checkins] python/dist/src/Lib/test test_sys.py,1.8,1.9
mwh at users.sourceforge.net
mwh at users.sourceforge.net
Tue Feb 15 16:26:14 CET 2005
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32682
Modified Files:
test_sys.py
Log Message:
Test that SystemExits are handled properly by the exit machinery. I
broke the "raise SystemExit(46)" case when doing new-style exceptions,
but I'd much rather have found out here than in test_tempfile (growl).
Index: test_sys.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sys.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- test_sys.py 6 Jul 2003 18:36:54 -0000 1.8
+++ test_sys.py 15 Feb 2005 15:26:11 -0000 1.9
@@ -161,6 +161,18 @@
else:
self.fail("no exception")
+ # test that the exit machinery handles SystemExits properly
+ import subprocess
+ # both unnormalized...
+ rc = subprocess.call([sys.executable, "-c",
+ "raise SystemExit, 46"])
+ self.assertEqual(rc, 46)
+ # ... and normalized
+ rc = subprocess.call([sys.executable, "-c",
+ "raise SystemExit(47)"])
+ self.assertEqual(rc, 47)
+
+
def test_getdefaultencoding(self):
if test.test_support.have_unicode:
self.assertRaises(TypeError, sys.getdefaultencoding, 42)
More information about the Python-checkins
mailing list