Support windowspaths >260 chars during collection

This commit is contained in:
Riezebos 2021-08-12 17:09:38 +02:00 committed by GitHub
parent 2439729413
commit 9f0e54db73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -38,6 +38,7 @@ from _pytest.fixtures import FixtureManager
from _pytest.outcomes import exit from _pytest.outcomes import exit
from _pytest.pathlib import absolutepath from _pytest.pathlib import absolutepath
from _pytest.pathlib import bestrelpath from _pytest.pathlib import bestrelpath
from _pytest.pathlib import ensure_extended_length_path
from _pytest.pathlib import fnmatch_ex from _pytest.pathlib import fnmatch_ex
from _pytest.pathlib import visit from _pytest.pathlib import visit
from _pytest.reports import CollectReport from _pytest.reports import CollectReport
@ -716,6 +717,7 @@ class Session(nodes.FSCollector):
# Let the Package collector deal with subnodes, don't collect here. # Let the Package collector deal with subnodes, don't collect here.
if argpath.is_dir(): if argpath.is_dir():
assert not names, f"invalid arg {(argpath, names)!r}" assert not names, f"invalid arg {(argpath, names)!r}"
argpath = ensure_extended_length_path(Path(argpath))
seen_dirs: Set[Path] = set() seen_dirs: Set[Path] = set()
for direntry in visit(str(argpath), self._recurse): for direntry in visit(str(argpath), self._recurse):