@@ -30,12 +30,16 @@ foo[extra] @ https://some-url/package.whl
30
30
bar @ https://example.org/bar-1.0.whl --hash=sha256:deadbeef
31
31
baz @ https://test.com/baz-2.0.whl; python_version < "3.8" --hash=sha256:deadb00f
32
32
qux @ 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
33
34
""" ,
34
35
"requirements_extra_args" : """\
35
36
--index-url=example.org
36
37
37
38
foo[extra]==0.0.1 \
38
39
--hash=sha256:deadbeef
40
+ """ ,
41
+ "requirements_git" : """
42
+ foo @ git+https://github.com/org/foo.git@deadbeef
39
43
""" ,
40
44
"requirements_linux" : """\
41
45
foo==0.0.3 --hash=sha256:deadbaaf
@@ -232,6 +236,31 @@ def _test_direct_urls(env):
232
236
whls = [],
233
237
),
234
238
],
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
+ ],
235
264
})
236
265
237
266
_tests .append (_test_direct_urls )
@@ -623,6 +652,36 @@ def _test_optional_hash(env):
623
652
624
653
_tests .append (_test_optional_hash )
625
654
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
+
626
685
def parse_requirements_test_suite (name ):
627
686
"""Create the test suite.
628
687
0 commit comments