MCPcopy Create free account
hub / github.com/python/mypy / test_crawl_no_namespace

Method test_crawl_no_namespace

mypy/test/test_find_sources.py:76–101  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

74 shutil.rmtree(self.tempdir)
75
76 def test_crawl_no_namespace(self) -> None:
77 options = Options()
78 options.namespace_packages = False
79
80 finder = SourceFinder(FakeFSCache({"/setup.py"}), options)
81 assert crawl(finder, "/setup.py") == ("setup", "/")
82
83 finder = SourceFinder(FakeFSCache({"/a/setup.py"}), options)
84 assert crawl(finder, "/a/setup.py") == ("setup", "/a")
85
86 finder = SourceFinder(FakeFSCache({"/a/b/setup.py"}), options)
87 assert crawl(finder, "/a/b/setup.py") == ("setup", "/a/b")
88
89 finder = SourceFinder(FakeFSCache({"/a/setup.py", "/a/__init__.py"}), options)
90 assert crawl(finder, "/a/setup.py") == ("a.setup", "/")
91
92 finder = SourceFinder(FakeFSCache({"/a/invalid-name/setup.py", "/a/__init__.py"}), options)
93 assert crawl(finder, "/a/invalid-name/setup.py") == ("setup", "/a/invalid-name")
94
95 finder = SourceFinder(FakeFSCache({"/a/b/setup.py", "/a/__init__.py"}), options)
96 assert crawl(finder, "/a/b/setup.py") == ("setup", "/a/b")
97
98 finder = SourceFinder(
99 FakeFSCache({"/a/b/c/setup.py", "/a/__init__.py", "/a/b/c/__init__.py"}), options
100 )
101 assert crawl(finder, "/a/b/c/setup.py") == ("c.setup", "/a/b")
102
103 def test_crawl_namespace(self) -> None:
104 options = Options()

Callers

nothing calls this directly

Calls 4

OptionsClass · 0.90
SourceFinderClass · 0.90
FakeFSCacheClass · 0.85
crawlFunction · 0.85

Tested by

no test coverage detected