diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-02-27 18:56:37 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-02-27 18:56:37 (GMT) |
commit | 049242b87c2855cebb9bbb8f8395eaed3430e653 (patch) | |
tree | 1c6c0afbb8e27c77b0d646f9e0d191b6de73cbf4 | |
parent | 49ac6f44920c9af21f9bb06944b6e7f23fd4ac58 (diff) | |
parent | d3113740894d07fefc1ba32b5998a4720e9e8711 (diff) | |
download | cpython-049242b87c2855cebb9bbb8f8395eaed3430e653.zip cpython-049242b87c2855cebb9bbb8f8395eaed3430e653.tar.gz cpython-049242b87c2855cebb9bbb8f8395eaed3430e653.tar.bz2 |
Issue #13125: Silence spurious test_lib2to3 output when in non-verbose mode.
Patch by Mikhail Novikov.
-rw-r--r-- | Lib/lib2to3/tests/test_parser.py | 13 | ||||
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
3 files changed, 14 insertions, 3 deletions
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py index f32404c..3968e6a 100644 --- a/Lib/lib2to3/tests/test_parser.py +++ b/Lib/lib2to3/tests/test_parser.py @@ -11,10 +11,14 @@ from __future__ import with_statement # Testing imports from . import support from .support import driver, test_dir +from test.support import verbose # Python imports import os +import sys import unittest +import warnings +import subprocess # Local imports from lib2to3.pgen2 import tokenize @@ -171,10 +175,12 @@ class TestParserIdempotency(support.TestCase): try: tree = driver.parse_string(source) except ParseError as err: - print('ParseError on file', filepath, err) + if verbose > 0: + warnings.warn('ParseError on file %s (%s)' % (filepath, err)) continue new = str(tree) - if diff(filepath, new): + x = diff(filepath, new) + if x: self.fail("Idempotency failed: %s" % filepath) def test_extended_unpacking(self): @@ -183,6 +189,7 @@ class TestParserIdempotency(support.TestCase): driver.parse_string("(z, *y, w) = m\n") driver.parse_string("for *z, m in d: pass\n") + class TestLiterals(GrammarTest): def validate(self, s): @@ -221,7 +228,7 @@ def diff(fn, result): with open('@', 'w') as f: f.write(str(result)) fn = fn.replace('"', '\\"') - return os.system('diff -u "%s" @' % fn) + return subprocess.call(['diff', '-u', fn, '@'], stdout=(subprocess.DEVNULL if verbose < 1 else None)) finally: try: os.remove("@") @@ -725,6 +725,7 @@ Stefan Norberg Tim Northover Joe Norton Neal Norwitz +Mikhail Novikov Michal Nowikowski Steffen Daode Nurpmeso Nigel O'Brian @@ -508,6 +508,9 @@ Core and Builtins Library ------- +- Issue #13125: Silence spurious test_lib2to3 output when in non-verbose mode. + Patch by Mikhail Novikov. + - Issue #11841: Fix comparison bug with 'rc' versions in packaging.version. Patch by Filip GruszczyĆski. |