Skip to content

Commit 6df98be

Browse files
author
hauntsaninja
committed
fix windows, add another test
1 parent 4ee14bb commit 6df98be

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
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: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ 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"]
271+
options.ignore_path = ["/pkg/a", "2", "1", "pk", "kg", "g.py", "bc", "/b"]
272272
finder = SourceFinder(FakeFSCache(files), options)
273273
assert len(find_sources(finder, "/")) == len(files)
274274

@@ -287,3 +287,17 @@ def test_find_sources_ignore_path(self) -> None:
287287
("a2.b.c.d.e", "/pkg"),
288288
("e", "/pkg/a1/b/c/d"),
289289
]
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)