Title: [Windows] test_compileall fails randomly with PermissionError: [WinError 5] Access is denied: (...).pyc
Type: Stage: resolved
Components: Tests, Windows Versions: Python 3.8
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: paul.moore, steve.dower, terry.reedy, tim.golden, vstinner, zach.ware
Priority: normal Keywords:

Created on 2018-06-27 09:16 by vstinner, last changed 2018-09-24 15:59 by vstinner. This issue is now closed.

Messages (4)
msg320558 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-27 09:16

FAIL: test_no_args_respects_force_flag (test.test_compileall.CommandLineTests)
Traceback (most recent call last):
  File "C:\\3.7.kloth-win64\build\lib\test\", line 301, in test_no_args_respects_force_flag
  File "C:\\3.7.kloth-win64\build\lib\test\", line 252, in assertRunOK
    *self._get_run_args(args), **env_vars)
  File "C:\\3.7.kloth-win64\build\lib\test\support\", line 157, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
  File "C:\\3.7.kloth-win64\build\lib\test\support\", line 143, in _assert_python
  File "C:\\3.7.kloth-win64\build\lib\test\support\", line 84, in fail
AssertionError: Process return code is 1
command line: ['C:\\\\3.7.kloth-win64\\build\\PCbuild\\amd64\\python_d.exe', '-X', 'faulthandler', '-S', '-m', 'compileall', '-f']

Compiling 'C:\\\\3.7.kloth-win64\\build\\lib\\'...
Compiling 'C:\\\\3.7.kloth-win64\\build\\lib\\'...
*** PermissionError: [WinError 5] Access is denied: 'C:\\\\3.7.kloth-win64\\build\\lib\\__pycache__\\socket.cpython-37.pyc.30129088' -> 'C:\\\\3.7.kloth-win64\\build\\lib\\__pycache__\\socket.cpython-37.pyc'
Compiling (...)
msg320564 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-27 09:38
See also bpo-20760 which seems to be a duplicate but doesn't have the full output (stdout is missing).
msg320733 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-29 19:44
#20760 reported failures on Linux.  I think one of these two issues should be closed.  FWIW, I ran
f:\dev\3x>python -m test -R 3:10 -m CommandLineTests test_compileall
twice with no failures.
msg320738 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-29 20:30
While the issue is rare, I am sure that there is a race condition. The bug
maybe happens when other tests run in parallel.

The test should work in its own temporary directory to no be bothered by
other tests.
Date User Action Args
2018-09-24 15:59:22vstinnersetstatus: open -> closed
resolution: out of date
stage: resolved
2018-06-29 20:30:28vstinnersetmessages: + msg320738
2018-06-29 19:44:02terry.reedysetnosy: + terry.reedy
messages: + msg320733
2018-06-27 09:38:25vstinnersetmessages: + msg320564
2018-06-27 09:16:35vstinnercreate