File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,6 +66,51 @@ class FakePackageFinder(BaseFakePackageFinder):
6666 with pytest .raises (ValueError , match = "Cannot find children of a squashed module." ):
6767 graph .find_children (module )
6868
69+ @pytest .mark .xfail (reason = "Not yet supported" )
70+ def test_namespace_package_passed_as_root (self ):
71+ file_system = FakeFileSystem (
72+ contents = """
73+ /path/to/mypackage/
74+ foo/
75+ __init__.py
76+ one.py
77+ two/
78+ __init__.py
79+ green.py
80+ blue.py
81+ bar/
82+ __init__.py
83+ three.py
84+ /different-path/to/mypackage/
85+ foobar/
86+ __init__.py
87+ four.py
88+ """ ,
89+ )
90+
91+ class FakePackageFinder (BaseFakePackageFinder ):
92+ directory_map = {
93+ # TODO - PackageFinder assumes only a single directory per package.
94+ # This isn't the case for namespace packages.
95+ "mypackage" : "/path/to/mypackage"
96+ }
97+
98+ with override_settings (FILE_SYSTEM = file_system , PACKAGE_FINDER = FakePackageFinder ()):
99+ graph = usecases .build_graph ("mypackage" )
100+
101+ assert graph .modules == {
102+ "mypackage" ,
103+ "mypackage.foo" ,
104+ "mypackage.foo.one" ,
105+ "mypackage.foo.two" ,
106+ "mypackage.foo.two.green" ,
107+ "mypackage.foo.two.blue" ,
108+ "mypackage.bar" ,
109+ "mypackage.bar.three" ,
110+ "mypackage.foobar" ,
111+ "mypackage.foobar.four" ,
112+ }
113+
69114 def test_boolean_additional_package_raises_type_error (self ):
70115 """
71116 Tests that a useful error message if build_graph is called
You can’t perform that action at this time.
0 commit comments