@@ -211,6 +211,80 @@ whl_library_targets_from_requires(
211211
212212_tests .append (_test_all_with_loads )
213213
214+ def _test_enable_implicit_namespace_pkgs_annotation (env ):
215+ want = """\
216+ load("@rules_python//python/private/pypi:whl_library_targets.bzl", "whl_library_targets")
217+
218+ whl_library_targets(
219+ dep_template = "@pypi//{name}:{target}",
220+ enable_implicit_namespace_pkgs = True,
221+ name = "foo.whl",
222+ dependencies = ["foo"],
223+ dependencies_by_platform = {"baz": ["bar"]},
224+ entry_points = {
225+ "foo": "bar.py",
226+ },
227+ group_deps = ["foo", "fox", "qux"],
228+ group_name = "qux",
229+ tags = ["tag1"],
230+ )
231+ """
232+ actual = generate_whl_library_build_bazel (
233+ dep_template = "@pypi//{name}:{target}" ,
234+ name = "foo.whl" ,
235+ dependencies = ["foo" ],
236+ dependencies_by_platform = {"baz" : ["bar" ]},
237+ entry_points = {
238+ "foo" : "bar.py" ,
239+ },
240+ annotation = struct (
241+ enable_implicit_namespace_pkgs = True ,
242+ ),
243+ group_name = "qux" ,
244+ group_deps = ["foo" , "fox" , "qux" ],
245+ tags = ["tag1" ],
246+ )
247+ env .expect .that_str (actual .replace ("@@" , "@" )).equals (want )
248+
249+ _tests .append (_test_enable_implicit_namespace_pkgs_annotation )
250+
251+ def _test_enable_implicit_namespace_pkgs_annotation_false (env ):
252+ want = """\
253+ load("@rules_python//python/private/pypi:whl_library_targets.bzl", "whl_library_targets")
254+
255+ whl_library_targets(
256+ dep_template = "@pypi//{name}:{target}",
257+ enable_implicit_namespace_pkgs = False,
258+ name = "foo.whl",
259+ dependencies = ["foo"],
260+ dependencies_by_platform = {"baz": ["bar"]},
261+ entry_points = {
262+ "foo": "bar.py",
263+ },
264+ group_deps = ["foo", "fox", "qux"],
265+ group_name = "qux",
266+ tags = ["tag1"],
267+ )
268+ """
269+ actual = generate_whl_library_build_bazel (
270+ dep_template = "@pypi//{name}:{target}" ,
271+ name = "foo.whl" ,
272+ dependencies = ["foo" ],
273+ dependencies_by_platform = {"baz" : ["bar" ]},
274+ entry_points = {
275+ "foo" : "bar.py" ,
276+ },
277+ annotation = struct (
278+ enable_implicit_namespace_pkgs = False ,
279+ ),
280+ group_name = "qux" ,
281+ group_deps = ["foo" , "fox" , "qux" ],
282+ tags = ["tag1" ],
283+ )
284+ env .expect .that_str (actual .replace ("@@" , "@" )).equals (want )
285+
286+ _tests .append (_test_enable_implicit_namespace_pkgs_annotation_false )
287+
214288def generate_whl_library_build_bazel_test_suite (name ):
215289 """Create the test suite.
216290
0 commit comments