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
{{ message }}
Repository navigation
Short paths in Windows seem to fail to be collected #11895
I don't have a MWE as I don't have a windows machine, but I'm reasonably confident that something in pytest 8 broke short path recognition on windows. I'll leave it to other devs to test further.
I don't have a MWE as I don't have a windows machine, but I'm reasonably confident that something in pytest 8 broke short path recognition on windows. I'll leave it to other devs to test further.
In order to narrow down on the issue, we'll probably need to bisect. I don't have windows either, but I can try with Wine. Can you provide instructions for reproducing the CI failure locally? (Doesn't have to be minimal).
You can likely make this much more minimal by using tempfile.mkdtemp() to make a directory, record the path that it returns (on the actions CLI it was a short path, so I expect it will be the same on a different machine). Then write a small test file that pytest should pickup to that directory and then run pytest <path> to that directory. That is effectively what the above xdoctest instructions are doing.
You can likely make this much more minimal by using tempfile.mkdtemp() to make a directory, record the path that it returns (on the actions CLI it was a short path, so I expect it will be the same on a different machine). Then write a small test file that pytest should pickup to that directory and then run pytest to that directory. That is effectively what the above xdoctest instructions are doing.
I did not investigate into details, but I cannot reproduce the behavior using a very short path:
There's a misunderstanding on what I mean by "short path". It's not a path with a short length, it's a windows shorthand to refer to a real path that's longer. It's like an autocomlete. E.g.
c:\PROGRA~2\Android\ANDROI~1 resolves to c:\Program Files (x86)\Android\android-sdk
λ pytest c:\PORTAB~1\test\
======================== test session starts ========================
platform win32 -- Python 3.10.10, pytest-8.1.0.dev108+gca3790102, pluggy-1.4.0
rootdir: e:\projects\pytest
plugins: hypothesis-6.84.0, replay-1.4.0
collected 0 items
======================= no tests ran in 0.02s =======================
ERROR: not found: c:\PORTAB~1\test
(no match in any of [<Dir >])
I will investigate this when I find some time, thanks for the report!
Activity
bluetech commentedon Jan 31, 2024
Thanks for the report.
In order to narrow down on the issue, we'll probably need to bisect. I don't have windows either, but I can try with Wine. Can you provide instructions for reproducing the CI failure locally? (Doesn't have to be minimal).
Erotemic commentedon Jan 31, 2024
I think this should work to reproduce it. On a window machine:
clone the latest version of xdoctest: https://github.com/Erotemic/xdoctest/tree/v1.1.3
pip install -e .to install it in development modeApply the following patch to remove the workaround I added to convert short paths into long paths:
install the version of pytest you want to test
Run the tests that cause the error (relative to the xdoctest repo root):
You can likely make this much more minimal by using
tempfile.mkdtemp()to make a directory, record the path that it returns (on the actions CLI it was a short path, so I expect it will be the same on a different machine). Then write a small test file that pytest should pickup to that directory and then runpytest <path>to that directory. That is effectively what the above xdoctest instructions are doing.nicoddemus commentedon Feb 1, 2024
I did not investigate into details, but I cannot reproduce the behavior using a very short path:
I'm afraid we will need more details to reproduce the issue.
Erotemic commentedon Feb 1, 2024
There's a misunderstanding on what I mean by "short path". It's not a path with a short length, it's a windows shorthand to refer to a real path that's longer. It's like an autocomlete. E.g.
c:\PROGRA~2\Android\ANDROI~1resolves toc:\Program Files (x86)\Android\android-sdkReference: https://superuser.com/questions/348079/how-can-i-find-the-short-path-of-a-windows-directory-file
It's a silly feature, but it seems
tempfile.mkdtempis able to return one, so it probably makes sense to support it.nicoddemus commentedon Feb 1, 2024
Ahh of course, brain fart on my part.
I can reproduce the issue:
I will investigate this when I find some time, thanks for the report!
bluetech commentedon Feb 1, 2024
I'm surprised this ever worked. Windows paths - the gift that keeps on giving :)
Add test for pytest-dev#11895
Fix collection of short paths on Windows
Fix collection of short paths on Windows
Fix collection of short paths on Windows
Add test for pytest-dev#11895
Fix collection of short paths on Windows
Add test for pytest-dev#11895
Fix collection of short paths on Windows
Fix collection of short paths on Windows (#11936)
Fix collection of short paths on Windows (pytest-dev#11936)
Use latest `pytest` and `xdoctest` (#1632)