You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a detailed description of the bug or problem you are having
output of pip list from the virtual environment you are using
pytest and operating system versions
minimal example if possible
When executing pytest on windows in a directory that contains files with a path longer than 260 characters, a FileNotFoundError occurs during test collection. The full output can be seen below.
Python: 3.9.6
pip list: (new conda environment with only python and pytest specified for installation)
(pytest) C:\Users\sriezebo\temptest>pytest
===================================================================================== test session starts ======================================================================================
platform win32 -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: C:\Users\sriezebo\temptest
collected 0 items / 1 error
============================================================================================ ERRORS ============================================================================================
________________________________________________________________________________ ERROR collecting test session _________________________________________________________________________________
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\runner.py:311: in from_call
result: Optional[TResult] = func()
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\runner.py:341: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\main.py:690: in collect
for direntry in visit(str(argpath), self._recurse):
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\pathlib.py:606: in visit
yield from visit(entry.path, recurse)
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\pathlib.py:606: in visit
yield from visit(entry.path, recurse)
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\pathlib.py:606: in visit
yield from visit(entry.path, recurse)
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\pathlib.py:606: in visit
yield from visit(entry.path, recurse)
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\pathlib.py:606: in visit
yield from visit(entry.path, recurse)
..\Miniconda3\envs\pytest\lib\site-packages\_pytest\pathlib.py:591: in visit
for entry in os.scandir(path):
E FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\sriezebo\\temptest\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
=================================================================================== short test summary info ====================================================================================
ERROR - FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\sriezebo\\temptest\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\aaaaaaaaaaaaaaaaaaaaaa...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================================= 1 error in 0.18s =======================================================================================
After downgrading pytest it works in the same folder:
(pytest) C:\Users\sriezebo\temptest>pytest
===================================================================================== test session starts ======================================================================================
platform win32 -- Python 3.9.6, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
rootdir: C:\Users\sriezebo\temptest
collected 0 items
==================================================================================== no tests ran in 0.02s =====================================================================================
The text was updated successfully, but these errors were encountered:
Thanks for the quick response!
I had a look at the code based on your suggestion. Running ensure_extended_length_path within visit might impact performance if large directory is scanned recursively. If the first call of visit already has been checked all recursive calls should work automatically.
To test this I added a line in this place in my local installation:
pip list
from the virtual environment you are usingWhen executing pytest on windows in a directory that contains files with a path longer than 260 characters, a FileNotFoundError occurs during test collection. The full output can be seen below.
Python: 3.9.6
pip list: (new conda environment with only python and pytest specified for installation)
A test file was created like this:
Then the following happens:
After downgrading pytest it works in the same folder:
The text was updated successfully, but these errors were encountered: