Skip to content

Commit f3ff83f

Browse files
author
hauntsaninja
committed
fix windows, add another test
1 parent ede5ac8 commit f3ff83f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

mypy/modulefinder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ def find_modules_recursive(self, module: str) -> List[BuildSource]:
476476

477477

478478
def matches_ignore_pattern(path: str, pattern: str) -> bool:
479+
path = os.path.splitdrive(path)[1]
479480
path_components = path.split(os.sep)
480481
pattern_components = pattern.split(os.sep)
481482
return all(

mypy/test/test_find_sources.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ def test_find_sources_ignore_path(self) -> None:
268268
"/pkg/a2/b/f.py",
269269
}
270270

271+
options.ignore_path = ["/pkg/a", "2", "1", "pk", "kg", "g.py", "bc", "/b"]
272+
finder = SourceFinder(FakeFSCache(files), options)
273+
assert len(find_sources(finder, "/")) == len(files)
274+
271275
options.ignore_path = ["/pkg/a1"]
272276
finder = SourceFinder(FakeFSCache(files), options)
273277
assert find_sources(finder, "/") == [
@@ -283,3 +287,17 @@ def test_find_sources_ignore_path(self) -> None:
283287
("a2.b.c.d.e", "/pkg"),
284288
("e", "/pkg/a1/b/c/d"),
285289
]
290+
291+
files = {
292+
"pkg/a1/b/c/d/e.py",
293+
"pkg/a1/b/f.py",
294+
"pkg/a2/__init__.py",
295+
"pkg/a2/b/c/d/e.py",
296+
"pkg/a2/b/f.py",
297+
}
298+
299+
options.ignore_path = [
300+
"/pkg/a", "2", "1", "pk", "kg", "g.py", "bc", "/b", "/pkg/a1", "/pkg/a2"
301+
]
302+
finder = SourceFinder(FakeFSCache(files), options)
303+
assert len(find_sources(finder, "/")) == len(files)

0 commit comments

Comments
 (0)