From 9f0e54db73924bd65c195bb0898503521a2e8510 Mon Sep 17 00:00:00 2001 From: Riezebos <22647971+Riezebos@users.noreply.github.com> Date: Thu, 12 Aug 2021 17:09:38 +0200 Subject: [PATCH] Support windowspaths >260 chars during collection --- src/_pytest/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/_pytest/main.py b/src/_pytest/main.py index e068fcb0c..e276b4039 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -38,6 +38,7 @@ from _pytest.fixtures import FixtureManager from _pytest.outcomes import exit from _pytest.pathlib import absolutepath from _pytest.pathlib import bestrelpath +from _pytest.pathlib import ensure_extended_length_path from _pytest.pathlib import fnmatch_ex from _pytest.pathlib import visit from _pytest.reports import CollectReport @@ -716,6 +717,7 @@ class Session(nodes.FSCollector): # Let the Package collector deal with subnodes, don't collect here. if argpath.is_dir(): assert not names, f"invalid arg {(argpath, names)!r}" + argpath = ensure_extended_length_path(Path(argpath)) seen_dirs: Set[Path] = set() for direntry in visit(str(argpath), self._recurse):