diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-03-09 22:17:33 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-03-09 22:17:33 +0200 |
commit | da9eeae48ed6ecd1774cb9da655e93c66660b70e (patch) | |
tree | f927e138a693c0bdf1a455524aaa027ff2e2265e /Lib | |
parent | 26e2faf57da5e1c26f7ea25e5a1cb066ad7020cb (diff) | |
download | cpython-git-da9eeae48ed6ecd1774cb9da655e93c66660b70e.tar.gz |
#11963: avoid printing messages in test_parser. Initial patch by Éric Araujo.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_parser.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index 12fa89cd46..bbb9436089 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -3,6 +3,7 @@ import unittest import sys import struct from test import test_support as support +from test.script_helper import assert_python_failure # # First, we test that we can generate trees from valid source fragments, @@ -579,7 +580,7 @@ class CompileTestCase(unittest.TestCase): class ParserStackLimitTestCase(unittest.TestCase): - """try to push the parser to/over it's limits. + """try to push the parser to/over its limits. see http://bugs.python.org/issue1881 for a discussion """ def _nested_expression(self, level): @@ -592,8 +593,10 @@ class ParserStackLimitTestCase(unittest.TestCase): def test_trigger_memory_error(self): e = self._nested_expression(100) - print >>sys.stderr, "Expecting 's_push: parser stack overflow' in next line" - self.assertRaises(MemoryError, parser.expr, e) + rc, out, err = assert_python_failure('-c', e) + # parsing the expression will result in an error message + # followed by a MemoryError (see #11963) + self.assertEqual(err, b's_push: parser stack overflow\nMemoryError') class STObjectTestCase(unittest.TestCase): """Test operations on ST objects themselves""" |