[issue7283] test_site failure when .local/lib/pythonX.Y/site-packages hasn't been created yet

STINNER Victor report at bugs.python.org
Tue May 2 05:45:25 EDT 2017


STINNER Victor added the comment:

It seems like the original bug report was fixed, so I close it.

@Berker Peksag: Please open a new bug report if you see again the PermissionError error on Windows. I didn't see it recently.


> Well, I'm not sure the symlink is actually the problem. Apparently the ".local" directory hadn't been created when the first test run.

I'm unable to reproduce this bug anymore. I named ~/.local to ~/.local.xxx: test_site pass (it starts by creating ~/.local/lib/python3.7/site-packages).

> I can't reproduce this locally. If remove ~/.local/lib/pythonX.Y and run test_site, it creates the directory and modifies sys.path (this is a bug).

I fixed this bug: commit b85c136903c6d2368162f7c4a58f258c9c69ead0, issue #30108.

> I just saw a similar failure on AppVeyor: FAIL: test_s_option (test.test_site.HelperFunctionsTests)

test_site failed twice. First run:

======================================================================
ERROR: test_underpth_file (test.test_site.StartupImportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_site.py", line 577, in test_underpth_file
    self._cleanup_underpth_exe(exe_file)
  File "C:\projects\cpython\lib\test\test_site.py", line 512, in _cleanup_underpth_exe
    test.support.unlink(exe_file)
  File "C:\projects\cpython\lib\test\support\__init__.py", line 398, in unlink
    _unlink(filename)
  File "C:\projects\cpython\lib\test\support\__init__.py", line 348, in _unlink
    _waitfor(os.unlink, filename)
  File "C:\projects\cpython\lib\test\support\__init__.py", line 316, in _waitfor
    func(pathname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\python.exe'
======================================================================
ERROR: test_underpth_nosite_file (test.test_site.StartupImportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_site.py", line 534, in test_underpth_nosite_file
    exe_file = self._create_underpth_exe(pth_lines)
  File "C:\projects\cpython\lib\test\test_site.py", line 495, in _create_underpth_exe
    shutil.copy(sys.executable, exe_file)
  File "C:\projects\cpython\lib\shutil.py", line 241, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\projects\cpython\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\python.exe'


Second run:

======================================================================
FAIL: test_s_option (test.test_site.HelperFunctionsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_site.py", line 173, in test_s_option
    self.assertIn(usersite, sys.path)
AssertionError: 'C:\\Users\\appveyor\\AppData\\Roaming\\Python\\Python36\\site-packages' not found in ['', 'C:\\projects\\cpython\\PCbuild\\win32\\python36.zip', 'C:\\projects\\cpython\\DLLs', 'C:\\projects\\cpython\\lib', 'C:\\projects\\cpython\\PCbuild\\win32', 'C:\\projects\\cpython', 'C:\\projects\\cpython\\lib\\site-packages']


The first failures are unrelated to this bug report. The first failure (PermissionError: [WinError 32] The process cannot access the file because it is being used by another process) seems like an antivirus holding the file open. Please open a different bug report if you see it again.

----------
nosy: +haypo
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list