[New-bugs-announce] [issue30117] test_lib2to3.test_parser.test_all_project_files() fails

STINNER Victor report at bugs.python.org
Thu Apr 20 08:45:21 EDT 2017


New submission from STINNER Victor:

The test_lib2to3.test_parser.test_all_project_files() test fails and produces an annoying output. See the issue #13125

Example of a buildbot:

0:11:09 [398/404] test_lib2to3 passed (39 sec)
--- /root/buildarea/3.x.angelico-debian-amd64/build/Lib/lib2to3/tests/data/bom.py	2017-02-11 12:20:43.532000000 +1100
+++ @	2017-04-20 22:05:37.157911808 +1000
@@ -1,2 +1,2 @@
-# coding: utf-8
+# coding: utf-8
 print "BOM BOOM!"

Example by running: ./python -m test -v test_lib2to3
---
test_all_project_files (lib2to3.tests.test_parser.TestParserIdempotency) ... /home/haypo/prog/python/master/Lib/lib2to3/tests/test_parser.py:393: UserWarning: ParseError on file /home/haypo/prog/python/master/Lib/lib2to3/main.py (bad input: type=22, value='=', context=('', (130, 38)))
  warnings.warn('ParseError on file %s (%s)' % (filepath, err))
/home/haypo/prog/python/master/Lib/lib2to3/tests/test_parser.py:393: UserWarning: ParseError on file /home/haypo/prog/python/master/Lib/lib2to3/tests/pytree_idempotency.py (bad input: type=22, value='=', context=('', (49, 33)))
  warnings.warn('ParseError on file %s (%s)' % (filepath, err))
--- /home/haypo/prog/python/master/Lib/lib2to3/tests/data/bom.py	2017-02-10 23:10:03.392778645 +0100
+++ @	2017-04-20 14:32:49.921613096 +0200
@@ -1,2 +1,2 @@
-# coding: utf-8
+# coding: utf-8
 print "BOM BOOM!"
expected failure
---


The test fails to parse the following code:
---
from __future__ import print_function
import sys
print("WARNING", file=sys.stderr)
---

whereas lib2to3 is able to parse the code. It seems like the code uses a lib2to3.tests.support.driver object. Maybe this object lacks the fixer which parses the __future__ imports?


The minimum fix would be to make the test quiet: remove the warning, don't log anything.

The best would be fix the test.

----------
components: Tests
keywords: easy
messages: 291970
nosy: haypo
priority: normal
severity: normal
status: open
title: test_lib2to3.test_parser.test_all_project_files() fails
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30117>
_______________________________________


More information about the New-bugs-announce mailing list