@@ -285,6 +285,104 @@ def _test_simple_multiple_requirements(env):
285285
286286_tests .append (_test_simple_multiple_requirements )
287287
288+ def _test_simple_multiple_python_versions (env ):
289+ pypi = _parse_modules (
290+ env ,
291+ module_ctx = _mock_mctx (
292+ _mod (
293+ name = "rules_python" ,
294+ parse = [
295+ _parse (
296+ hub_name = "pypi" ,
297+ python_version = "3.15" ,
298+ requirements_lock = "requirements_3_15.txt" ,
299+ ),
300+ _parse (
301+ hub_name = "pypi" ,
302+ python_version = "3.16" ,
303+ requirements_lock = "requirements_3_16.txt" ,
304+ ),
305+ ],
306+ ),
307+ read = lambda x : {
308+ "requirements_3_15.txt" : """
309+ simple==0.0.1 --hash=sha256:deadbeef
310+ old-package==0.0.1 --hash=sha256:deadbaaf
311+ """ ,
312+ "requirements_3_16.txt" : """
313+ simple==0.0.2 --hash=sha256:deadb00f
314+ new-package==0.0.1 --hash=sha256:deadb00f2
315+ """ ,
316+ }[x ],
317+ ),
318+ available_interpreters = {
319+ "python_3_15_host" : "unit_test_interpreter_target" ,
320+ "python_3_16_host" : "unit_test_interpreter_target" ,
321+ },
322+ minor_mapping = {
323+ "3.15" : "3.15.19" ,
324+ "3.16" : "3.16.9" ,
325+ },
326+ )
327+
328+ pypi .exposed_packages ().contains_exactly ({"pypi" : ["simple" ]})
329+ pypi .hub_group_map ().contains_exactly ({"pypi" : {}})
330+ pypi .hub_whl_map ().contains_exactly ({
331+ "pypi" : {
332+ "new_package" : {
333+ "pypi_316_new_package" : [
334+ whl_config_setting (
335+ version = "3.16" ,
336+ ),
337+ ],
338+ },
339+ "old_package" : {
340+ "pypi_315_old_package" : [
341+ whl_config_setting (
342+ version = "3.15" ,
343+ ),
344+ ],
345+ },
346+ "simple" : {
347+ "pypi_315_simple" : [
348+ whl_config_setting (
349+ version = "3.15" ,
350+ ),
351+ ],
352+ "pypi_316_simple" : [
353+ whl_config_setting (
354+ version = "3.16" ,
355+ ),
356+ ],
357+ },
358+ },
359+ })
360+ pypi .whl_libraries ().contains_exactly ({
361+ "pypi_315_old_package" : {
362+ "dep_template" : "@pypi//{name}:{target}" ,
363+ "python_interpreter_target" : "unit_test_interpreter_target" ,
364+ "requirement" : "old-package==0.0.1 --hash=sha256:deadbaaf" ,
365+ },
366+ "pypi_315_simple" : {
367+ "dep_template" : "@pypi//{name}:{target}" ,
368+ "python_interpreter_target" : "unit_test_interpreter_target" ,
369+ "requirement" : "simple==0.0.1 --hash=sha256:deadbeef" ,
370+ },
371+ "pypi_316_new_package" : {
372+ "dep_template" : "@pypi//{name}:{target}" ,
373+ "python_interpreter_target" : "unit_test_interpreter_target" ,
374+ "requirement" : "new-package==0.0.1 --hash=sha256:deadb00f2" ,
375+ },
376+ "pypi_316_simple" : {
377+ "dep_template" : "@pypi//{name}:{target}" ,
378+ "python_interpreter_target" : "unit_test_interpreter_target" ,
379+ "requirement" : "simple==0.0.2 --hash=sha256:deadb00f" ,
380+ },
381+ })
382+ pypi .whl_mods ().contains_exactly ({})
383+
384+ _tests .append (_test_simple_multiple_python_versions )
385+
288386def _test_simple_with_markers (env ):
289387 pypi = _parse_modules (
290388 env ,
0 commit comments