@@ -49,6 +49,20 @@ simple==0.0.1 \
4949 ],
5050 )
5151
52+ def _whl_mod (* , hub_name , whl_name , additive_build_content = None , additive_build_content_file = None , copy_executables = {}, copy_files = {}, data = [], data_exclude_glob = [], srcs_exclude_glob = [], enable_implicit_namespace_pkgs = None ):
53+ return struct (
54+ hub_name = hub_name ,
55+ whl_name = whl_name ,
56+ additive_build_content = additive_build_content ,
57+ additive_build_content_file = additive_build_content_file ,
58+ copy_executables = copy_executables ,
59+ copy_files = copy_files ,
60+ data = data ,
61+ data_exclude_glob = data_exclude_glob ,
62+ srcs_exclude_glob = srcs_exclude_glob ,
63+ enable_implicit_namespace_pkgs = enable_implicit_namespace_pkgs ,
64+ )
65+
5266def _mod (* , name , default = [], parse = [], override = [], whl_mods = [], is_root = True ):
5367 return struct (
5468 name = name ,
@@ -234,6 +248,69 @@ def _test_build_pipstar_platform(env):
234248
235249_tests .append (_test_build_pipstar_platform )
236250
251+ def _test_whl_mods_with_namespace_pkgs (env ):
252+ pypi = _parse_modules (
253+ env ,
254+ module_ctx = _mock_mctx (
255+ _mod (
256+ name = "rules_python" ,
257+ parse = [
258+ _parse (
259+ hub_name = "pypi" ,
260+ python_version = "3.15" ,
261+ requirements_lock = "requirements.txt" ,
262+ ),
263+ ],
264+ whl_mods = [
265+ _whl_mod (
266+ hub_name = "pypi" ,
267+ whl_name = "simple" ,
268+ additive_build_content = "# Custom build content" ,
269+ enable_implicit_namespace_pkgs = True ,
270+ ),
271+ ],
272+ ),
273+ ),
274+ available_interpreters = {
275+ "python_3_15_host" : "unit_test_interpreter_target" ,
276+ },
277+ minor_mapping = {"3.15" : "3.15.19" },
278+ )
279+
280+ pypi .exposed_packages ().contains_exactly ({"pypi" : ["simple" ]})
281+ pypi .hub_group_map ().contains_exactly ({"pypi" : {}})
282+ pypi .hub_whl_map ().contains_exactly ({"pypi" : {
283+ "simple" : {
284+ "pypi_315_simple" : [
285+ whl_config_setting (
286+ version = "3.15" ,
287+ ),
288+ ],
289+ },
290+ }})
291+ pypi .whl_libraries ().contains_exactly ({
292+ "pypi_315_simple" : {
293+ "dep_template" : "@pypi//{name}:{target}" ,
294+ "python_interpreter_target" : "unit_test_interpreter_target" ,
295+ "requirement" : "simple==0.0.1 --hash=sha256:deadbeef --hash=sha256:deadbaaf" ,
296+ },
297+ })
298+ pypi .whl_mods ().contains_exactly ({
299+ "pypi" : {
300+ "simple" : struct (
301+ build_content = "# Custom build content" ,
302+ copy_files = {},
303+ copy_executables = {},
304+ data = [],
305+ data_exclude_glob = [],
306+ srcs_exclude_glob = [],
307+ enable_implicit_namespace_pkgs = True ,
308+ ),
309+ },
310+ })
311+
312+ _tests .append (_test_whl_mods_with_namespace_pkgs )
313+
237314def extension_test_suite (name ):
238315 """Create the test suite.
239316
0 commit comments