# 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
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):
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):
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("@")
Library
-------
+- Issue #13125: Silence spurious test_lib2to3 output when in non-verbose mode.
+ Patch by Mikhail Novikov.
+
- Issue #13447: Add a test file to host regression tests for bugs in the
scripts found in the Tools directory.