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.

classification
Title: lib2to3 tests fail on the 3.7 branch (used to work with 3.7.0)
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: berker.peksag Nosy List: berker.peksag, brett.cannon, doko, eric.snow, ncoghlan, ned.deily, terry.reedy
Priority: normal Keywords: 3.7regression

Created on 2018-07-31 03:18 by doko, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7)
msg322714 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2018-07-31 03:18
running the lib2to3 tests from an installed location, I see the following failures on the 3.7 branch:

======================================================================
FAIL: test (lib2to3.tests.test_fixers.Test_reload)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 294, in test
    self.check(b, a)
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 36, in check
    tree = self._check(before, after)
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 32, in _check
    self.assertEqual(after, str(tree))
AssertionError: 'import importlib\nimportlib.reload(a)\n\n' != 'import imp\nimp.reload(a)\n\n'
- import importlib
?           ------
+ import imp
- importlib.reload(a)
?    ------
+ imp.reload(a)
  


======================================================================
FAIL: test_comment (lib2to3.tests.test_fixers.Test_reload)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 299, in test_comment
    self.check(b, a)
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 36, in check
    tree = self._check(before, after)
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 32, in _check
    self.assertEqual(after, str(tree))
AssertionError: 'import importlib\nimportlib.reload( a ) # comment\n\n' != 'import imp\nimp.reload( a ) # comment\n\n'
- import importlib
?           ------
+ import imp
- importlib.reload( a ) # comment
?    ------
+ imp.reload( a ) # comment
  


======================================================================
FAIL: test_space (lib2to3.tests.test_fixers.Test_reload)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 309, in test_space
    self.check(b, a)
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 36, in check
    tree = self._check(before, after)
  File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 32, in _check
    self.assertEqual(after, str(tree))
AssertionError: 'import importlib\nimportlib.reload( a )\n\n' != 'import imp\nimp.reload( a )\n\n'
- import importlib
?           ------
+ import imp
- importlib.reload( a )
?    ------
+ imp.reload( a )
  


----------------------------------------------------------------------
Ran 650 tests in 27.363s

FAILED (failures=3)
test test_lib2to3 failed
1 test failed again:
    test_lib2to3

== Tests result: FAILURE then FAILURE ==

390 tests OK.

1 test failed:
    test_lib2to3
msg322807 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2018-07-31 19:14
Could be related to https://bugs.python.org/issue21446 .
msg322867 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-08-01 15:28
I'm not able to reproduce this:

 ./configure
 make -s -j
 sudo make install
 python3.7 -m test test_lib2to3

 Run tests sequentially
 0:00:00 load avg: 0.86 [1/1] test_lib2to3

 == Tests result: SUCCESS ==

 1 test OK.

 Total duration: 13 sec 456 ms
 Tests result: SUCCESS
msg322899 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2018-08-02 00:03
strange. I see it succeeding in the build location, not the install location.  Did you make sure to cd /tmp before running the test?

I still can reproduce it:

$ python3.7 -m test test_lib2to3
Run tests sequentially
0:00:00 load avg: 0.24 [1/1] test_lib2to3
test test_lib2to3 failed -- multiple errors occurred; run in verbose mode for details
test_lib2to3 failed

== Tests result: FAILURE ==

1 test failed:
    test_lib2to3

Total duration: 5 sec 211 ms
Tests result: FAILURE
msg322902 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-08-02 00:32
I ran "python3.7 -m test test_lib2to3" in a separate terminal. I don't remember the exact location, but I'm sure it wasn't the build location (it was probably my home directory)

Is it possible to add some debug print()s inside https://github.com/python/cpython/blob/3.7/Lib/lib2to3/tests/support.py#L37 ? My only guess is that the test code somehow finds the wrong refactorer.
msg323089 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-03 22:11
test_lib2to3 passes for me on Win 10 for both installed 3.7.0 (in home directory) and repository 3.7 (in clone directory) compiled yesterday.
msg325278 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-09-13 18:43
I can't reproduce this either using a current top of 3.7 branch and installed on macOS; I also tried building 3.7 just prior to the fix for Issue21446 that Brett mentioned; the test also did not fail.  Let's close this until it can be reproduced outside of doko's environment.
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78467
2018-09-13 18:43:19ned.deilysetstatus: open -> closed

nosy: + ned.deily
messages: + msg325278

resolution: works for me
stage: needs patch -> resolved
2018-08-03 22:11:55terry.reedysetnosy: + terry.reedy
messages: + msg323089
2018-08-02 00:32:19berker.peksagsetmessages: + msg322902
2018-08-02 00:03:09dokosetmessages: + msg322899
2018-08-01 15:28:03berker.peksagsetmessages: + msg322867
2018-07-31 21:28:57berker.peksagsetassignee: berker.peksag
stage: needs patch
type: behavior
versions: + Python 3.7, Python 3.8
2018-07-31 19:14:24brett.cannonsetnosy: + berker.peksag
messages: + msg322807
2018-07-31 03:18:11dokocreate