This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017年04月20日 12:45 by vstinner, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 1242 | merged | Eric Appelt, 2017年04月21日 16:13 | |
| PR 5443 | merged | benjamin.peterson, 2018年01月30日 07:14 | |
| Messages (8) | |||
|---|---|---|---|
| msg291970 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2017年04月20日 12:45 | |
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. |
|||
| msg292059 - (view) | Author: Eric Appelt (Eric Appelt) * | Date: 2017年04月21日 16:14 | |
I added a PR to fix these two (in my opinion) spurious failure conditions in the lib2to3.tests.test_parser.TestParserIdempotency test_parser test with the following changes to the test: 1. Use the same encoding found in the initial file to write a temp file for a diff. This retains the BOM if the encoding was initially utf-8-sig. 2. If the file cannot be parsed using the normal grammar, try again with no print statement which should succeed for valid files using future print_function For case (1), the driver was correctly handling a BOM in a utf-8 file, but then the test was not writing a comparison file using 'utf-8-sig' to diff against, so the BOM got removed. I don't think that is the fault of the parser, and lib2to3 will retain the BOM. For case (2), lib2to3 pre-detects the use of from __future__ import print_function or allows the user to force this interpretation with a -p flag, and then selects a different grammar with the print statement removed. That makes the test cases unfair to this test as the driver itself doesn't know which grammar to use. As a minimal fix, the test will try using a grammar with the print statement, and if that fails fall back on a grammar without it. A more thorough handling of the idempotency test would to be to parse all files using both grammars and ignore if one of the two failed but otherwise check both. I didn't think this was necessary but can change. |
|||
| msg311246 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2018年01月30日 07:13 | |
New changeset 14e976e00e65bf343ba0fca016c3c9132a843daf by Benjamin Peterson (Eric Appelt) in branch 'master': closes bpo-30117: fix lib2to3 ParserIdempotency test (GH-1242) https://github.com/python/cpython/commit/14e976e00e65bf343ba0fca016c3c9132a843daf |
|||
| msg311262 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2018年01月30日 10:29 | |
Failure on AMD64 Windows8.1 Non-Debug 3.x: http://buildbot.python.org/all/#/builders/12/builds/585 ====================================================================== ERROR: test_all_project_files (lib2to3.tests.test_parser.TestParserIdempotency) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\buildarea3円.x.ware-win81-release\build\lib\lib2to3\tests\test_parser.py", line 432, in test_all_project_files x = diff(filepath, new, encoding=encoding) File "D:\buildarea3円.x.ware-win81-release\build\lib\lib2to3\tests\test_parser.py", line 488, in diff return subprocess.call(['diff', '-u', fn, '@'], stdout=(subprocess.DEVNULL if verbose < 1 else None)) File "D:\buildarea3円.x.ware-win81-release\build\lib\subprocess.py", line 304, in call with Popen(*popenargs, **kwargs) as p: File "D:\buildarea3円.x.ware-win81-release\build\lib\subprocess.py", line 756, in __init__ restore_signals, start_new_session) File "D:\buildarea3円.x.ware-win81-release\build\lib\subprocess.py", line 1160, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified |
|||
| msg311264 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2018年01月30日 10:33 | |
Different failure on AMD64 Windows10 3.x: ====================================================================== FAIL: test_all_project_files (lib2to3.tests.test_parser.TestParserIdempotency) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\buildarea3円.x.bolen-windows10\build\lib\lib2to3\tests\test_parser.py", line 434, in test_all_project_files self.fail("Idempotency failed: %s" % filepath) AssertionError: Idempotency failed: D:\buildarea3円.x.bolen-windows10\build\lib\lib2to3\btm_matcher.py |
|||
| msg311266 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2018年01月30日 11:04 | |
x86 Windows7 3.x: http://buildbot.python.org/all/#/builders/58/builds/563 ====================================================================== FAIL: test_nonexisting_with_pipes (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea3円.x.bolen-windows7\build\lib\test\test_subprocess.py", line 1194, in test_nonexisting_with_pipes self.assertEqual(stderr, "") AssertionError: 'Traceback (most recent call last):\n Fil[1129 chars]le\n' != '' Diff is 1153 characters long. Set self.maxDiff to None to see it. |
|||
| msg311287 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2018年01月30日 18:22 | |
1e17d4aaff5c7ca972bab437949d2bb51c5b30f7. I don't think you can pin test_subprocess on this change, though. |
|||
| msg311288 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2018年01月30日 18:23 | |
New changeset a23a2c555c4187f349276fe2f2ceffa953d0afe9 by Benjamin Peterson in branch '3.6': [3.6] closes bpo-30117: fix lib2to3 ParserIdempotency test (GH-1242) (GH-5443) https://github.com/python/cpython/commit/a23a2c555c4187f349276fe2f2ceffa953d0afe9 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:45 | admin | set | github: 74303 |
| 2018年09月26日 12:16:18 | xtreak | link | issue31837 superseder |
| 2018年01月30日 18:23:21 | benjamin.peterson | set | messages: + msg311288 |
| 2018年01月30日 18:22:28 | benjamin.peterson | set | status: open -> closed resolution: fixed messages: + msg311287 |
| 2018年01月30日 11:04:23 | vstinner | set | messages: + msg311266 |
| 2018年01月30日 10:33:25 | vstinner | set | messages: + msg311264 |
| 2018年01月30日 10:29:55 | vstinner | set | status: closed -> open resolution: fixed -> (no value) messages: + msg311262 |
| 2018年01月30日 07:14:37 | benjamin.peterson | set | pull_requests: + pull_request5275 |
| 2018年01月30日 07:13:06 | benjamin.peterson | set | status: open -> closed nosy: + benjamin.peterson messages: + msg311246 resolution: fixed stage: resolved |
| 2017年04月21日 16:14:58 | Eric Appelt | set | nosy:
+ Eric Appelt messages: + msg292059 |
| 2017年04月21日 16:13:03 | Eric Appelt | set | pull_requests: + pull_request1360 |
| 2017年04月20日 12:45:52 | vstinner | set | nosy:
+ barry |
| 2017年04月20日 12:45:21 | vstinner | create | |