From 39191840140c6a56f103290bf8c0a10e88cffd7b Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Sat, 9 Mar 2013 22:17:33 +0200 Subject: [PATCH] =?utf8?q?#11963:=20avoid=20printing=20messages=20in=20tes?= =?utf8?q?t=5Fparser.=20=20Initial=20patch=20by=20=C3=89ric=20Araujo.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Lib/test/test_parser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index 70eb9c0cc2..face39af3b 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -4,6 +4,7 @@ import sys import operator import struct from test import support +from test.script_helper import assert_python_failure # # First, we test that we can generate trees from valid source fragments, @@ -607,10 +608,10 @@ class ParserStackLimitTestCase(unittest.TestCase): def test_trigger_memory_error(self): e = self._nested_expression(100) - print("Expecting 's_push: parser stack overflow' in next line", - file=sys.stderr) - sys.stderr.flush() - 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""" -- 2.40.0