@@ -30,12 +30,16 @@ foo[extra] @ https://some-url/package.whl
3030bar @ https://example.org/bar-1.0.whl --hash=sha256:deadbeef 
3131baz @ https://test.com/baz-2.0.whl; python_version < "3.8" --hash=sha256:deadb00f 
3232qux @ https://example.org/qux-1.0.tar.gz --hash=sha256:deadbe0f 
33+ torch @ https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp311-cp311-linux_x86_64.whl#sha256=5b6ae523bfb67088a17ca7734d131548a2e60346c622621e4248ed09dd0790cc 
3334""" ,
3435        "requirements_extra_args" : """\  
3536 --index-url=example.org
3637
3738foo[extra]==0.0.1 \  
3839     --hash=sha256:deadbeef
40+ """ ,
41+         "requirements_git" : """ 
42+ foo @ git+https://github.com/org/foo.git@deadbeef 
3943""" ,
4044        "requirements_linux" : """\  
4145 foo==0.0.3 --hash=sha256:deadbaaf
@@ -232,6 +236,31 @@ def _test_direct_urls(env):
232236                whls  =  [],
233237            ),
234238        ],
239+         "torch" : [
240+             struct (
241+                 distribution  =  "torch" ,
242+                 extra_pip_args  =  [],
243+                 is_exposed  =  True ,
244+                 sdist  =  None ,
245+                 srcs  =  struct (
246+                     marker  =  "" ,
247+                     requirement  =  "torch @ https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp311-cp311-linux_x86_64.whl#sha256=5b6ae523bfb67088a17ca7734d131548a2e60346c622621e4248ed09dd0790cc" ,
248+                     requirement_line  =  "torch @ https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp311-cp311-linux_x86_64.whl#sha256=5b6ae523bfb67088a17ca7734d131548a2e60346c622621e4248ed09dd0790cc" ,
249+                     shas  =  [],
250+                     url  =  "https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp311-cp311-linux_x86_64.whl#sha256=5b6ae523bfb67088a17ca7734d131548a2e60346c622621e4248ed09dd0790cc" ,
251+                     version  =  "" ,
252+                 ),
253+                 target_platforms  =  ["linux_x86_64" ],
254+                 whls  =  [
255+                     struct (
256+                         filename  =  "torch-2.6.0%2Bcpu-cp311-cp311-linux_x86_64.whl" ,
257+                         sha256  =  "" ,
258+                         url  =  "https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp311-cp311-linux_x86_64.whl#sha256=5b6ae523bfb67088a17ca7734d131548a2e60346c622621e4248ed09dd0790cc" ,
259+                         yanked  =  False ,
260+                     ),
261+                 ],
262+             ),
263+         ],
235264    })
236265
237266_tests .append (_test_direct_urls )
@@ -623,6 +652,36 @@ def _test_optional_hash(env):
623652
624653_tests .append (_test_optional_hash )
625654
655+ def  _test_git_sources (env ):
656+     got  =  parse_requirements (
657+         ctx  =  _mock_ctx (),
658+         requirements_by_platform  =  {
659+             "requirements_git" : ["linux_x86_64" ],
660+         },
661+     )
662+     env .expect .that_dict (got ).contains_exactly ({
663+         "foo" : [
664+             struct (
665+                 distribution  =  "foo" ,
666+                 extra_pip_args  =  [],
667+                 is_exposed  =  True ,
668+                 sdist  =  None ,
669+                 srcs  =  struct (
670+                     marker  =  "" ,
671+                     requirement  =  "foo @ git+https://github.com/org/foo.git@deadbeef" ,
672+                     requirement_line  =  "foo @ git+https://github.com/org/foo.git@deadbeef" ,
673+                     shas  =  [],
674+                     url  =  "git+https://github.com/org/foo.git@deadbeef" ,
675+                     version  =  "" ,
676+                 ),
677+                 target_platforms  =  ["linux_x86_64" ],
678+                 whls  =  [],
679+             ),
680+         ],
681+     })
682+ 
683+ _tests .append (_test_git_sources )
684+ 
626685def  parse_requirements_test_suite (name ):
627686    """Create the test suite. 
628687
0 commit comments