mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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).
This commit is contained in:
parent
a1fb4c891f
commit
f058858347
1 changed files with 12 additions and 0 deletions
|
@ -161,6 +161,18 @@ class SysModuleTest(unittest.TestCase):
|
|||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue