@@ -26,7 +26,10 @@ foo==0.0.1 \
26
26
--hash=sha256:deadb00f
27
27
""" ,
28
28
"requirements_direct" : """\
29
- foo[extra] @ https://some-url
29
+ foo[extra] @ https://some-url/package.whl
30
+ bar @ https://example.org/bar-1.0.whl --hash=sha256:deadbeef
31
+ baz @ https://test.com/baz-2.0.whl; python_version < "3.8" --hash=sha256:deadb00f
32
+ qux @ https://example.org/qux-1.0.tar.gz --hash=sha256:deadbe0f
30
33
""" ,
31
34
"requirements_extra_args" : """\
32
35
--index-url=example.org
@@ -106,6 +109,7 @@ def _test_simple(env):
106
109
requirement_line = "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
107
110
shas = ["deadbeef" ],
108
111
version = "0.0.1" ,
112
+ url = "" ,
109
113
),
110
114
target_platforms = [
111
115
"linux_x86_64" ,
@@ -124,6 +128,110 @@ def _test_simple(env):
124
128
125
129
_tests .append (_test_simple )
126
130
131
+ def _test_direct_urls (env ):
132
+ got = parse_requirements (
133
+ ctx = _mock_ctx (),
134
+ requirements_by_platform = {
135
+ "requirements_direct" : ["linux_x86_64" ],
136
+ },
137
+ )
138
+ env .expect .that_dict (got ).contains_exactly ({
139
+ "bar" : [
140
+ struct (
141
+ distribution = "bar" ,
142
+ extra_pip_args = [],
143
+ sdist = None ,
144
+ is_exposed = True ,
145
+ srcs = struct (
146
+ marker = "" ,
147
+ requirement = "bar @ https://example.org/bar-1.0.whl --hash=sha256:deadbeef" ,
148
+ requirement_line = "bar @ https://example.org/bar-1.0.whl --hash=sha256:deadbeef" ,
149
+ shas = ["deadbeef" ],
150
+ version = "" ,
151
+ url = "https://example.org/bar-1.0.whl" ,
152
+ ),
153
+ target_platforms = ["linux_x86_64" ],
154
+ whls = [struct (
155
+ url = "https://example.org/bar-1.0.whl" ,
156
+ filename = "bar-1.0.whl" ,
157
+ sha256 = "deadbeef" ,
158
+ yanked = False ,
159
+ )],
160
+ ),
161
+ ],
162
+ "baz" : [
163
+ struct (
164
+ distribution = "baz" ,
165
+ extra_pip_args = [],
166
+ sdist = None ,
167
+ is_exposed = True ,
168
+ srcs = struct (
169
+ marker = "python_version < \" 3.8\" " ,
170
+ requirement = "baz @ https://test.com/baz-2.0.whl --hash=sha256:deadb00f" ,
171
+ requirement_line = "baz @ https://test.com/baz-2.0.whl --hash=sha256:deadb00f" ,
172
+ shas = ["deadb00f" ],
173
+ version = "" ,
174
+ url = "https://test.com/baz-2.0.whl" ,
175
+ ),
176
+ target_platforms = ["linux_x86_64" ],
177
+ whls = [struct (
178
+ url = "https://test.com/baz-2.0.whl" ,
179
+ filename = "baz-2.0.whl" ,
180
+ sha256 = "deadb00f" ,
181
+ yanked = False ,
182
+ )],
183
+ ),
184
+ ],
185
+ "foo" : [
186
+ struct (
187
+ distribution = "foo" ,
188
+ extra_pip_args = [],
189
+ sdist = None ,
190
+ is_exposed = True ,
191
+ srcs = struct (
192
+ marker = "" ,
193
+ requirement = "foo[extra] @ https://some-url/package.whl" ,
194
+ requirement_line = "foo[extra] @ https://some-url/package.whl" ,
195
+ shas = [],
196
+ version = "" ,
197
+ url = "https://some-url/package.whl" ,
198
+ ),
199
+ target_platforms = ["linux_x86_64" ],
200
+ whls = [struct (
201
+ url = "https://some-url/package.whl" ,
202
+ filename = "package.whl" ,
203
+ sha256 = "" ,
204
+ yanked = False ,
205
+ )],
206
+ ),
207
+ ],
208
+ "qux" : [
209
+ struct (
210
+ distribution = "qux" ,
211
+ extra_pip_args = [],
212
+ sdist = struct (
213
+ url = "https://example.org/qux-1.0.tar.gz" ,
214
+ filename = "qux-1.0.tar.gz" ,
215
+ sha256 = "deadbe0f" ,
216
+ yanked = False ,
217
+ ),
218
+ is_exposed = True ,
219
+ srcs = struct (
220
+ marker = "" ,
221
+ requirement = "qux @ https://example.org/qux-1.0.tar.gz --hash=sha256:deadbe0f" ,
222
+ requirement_line = "qux @ https://example.org/qux-1.0.tar.gz --hash=sha256:deadbe0f" ,
223
+ shas = ["deadbe0f" ],
224
+ version = "" ,
225
+ url = "https://example.org/qux-1.0.tar.gz" ,
226
+ ),
227
+ target_platforms = ["linux_x86_64" ],
228
+ whls = [],
229
+ ),
230
+ ],
231
+ })
232
+
233
+ _tests .append (_test_direct_urls )
234
+
127
235
def _test_extra_pip_args (env ):
128
236
got = parse_requirements (
129
237
ctx = _mock_ctx (),
@@ -145,6 +253,7 @@ def _test_extra_pip_args(env):
145
253
requirement_line = "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
146
254
shas = ["deadbeef" ],
147
255
version = "0.0.1" ,
256
+ url = "" ,
148
257
),
149
258
target_platforms = [
150
259
"linux_x86_64" ,
@@ -182,6 +291,7 @@ def _test_dupe_requirements(env):
182
291
requirement_line = "foo[extra,extra_2]==0.0.1 --hash=sha256:deadbeef" ,
183
292
shas = ["deadbeef" ],
184
293
version = "0.0.1" ,
294
+ url = "" ,
185
295
),
186
296
target_platforms = ["linux_x86_64" ],
187
297
whls = [],
@@ -211,6 +321,7 @@ def _test_multi_os(env):
211
321
requirement_line = "bar==0.0.1 --hash=sha256:deadb00f" ,
212
322
shas = ["deadb00f" ],
213
323
version = "0.0.1" ,
324
+ url = "" ,
214
325
),
215
326
target_platforms = ["windows_x86_64" ],
216
327
whls = [],
@@ -228,6 +339,7 @@ def _test_multi_os(env):
228
339
requirement_line = "foo==0.0.3 --hash=sha256:deadbaaf" ,
229
340
shas = ["deadbaaf" ],
230
341
version = "0.0.3" ,
342
+ url = "" ,
231
343
),
232
344
target_platforms = ["linux_x86_64" ],
233
345
whls = [],
@@ -243,6 +355,7 @@ def _test_multi_os(env):
243
355
requirement_line = "foo[extra]==0.0.2 --hash=sha256:deadbeef" ,
244
356
shas = ["deadbeef" ],
245
357
version = "0.0.2" ,
358
+ url = "" ,
246
359
),
247
360
target_platforms = ["windows_x86_64" ],
248
361
whls = [],
@@ -282,6 +395,7 @@ def _test_multi_os_legacy(env):
282
395
requirement_line = "bar==0.0.1 --hash=sha256:deadb00f" ,
283
396
shas = ["deadb00f" ],
284
397
version = "0.0.1" ,
398
+ url = "" ,
285
399
),
286
400
target_platforms = ["cp39_linux_x86_64" ],
287
401
whls = [],
@@ -299,6 +413,7 @@ def _test_multi_os_legacy(env):
299
413
requirement_line = "foo==0.0.1 --hash=sha256:deadbeef" ,
300
414
shas = ["deadbeef" ],
301
415
version = "0.0.1" ,
416
+ url = "" ,
302
417
),
303
418
target_platforms = ["cp39_linux_x86_64" ],
304
419
whls = [],
@@ -314,6 +429,7 @@ def _test_multi_os_legacy(env):
314
429
requirement = "foo==0.0.3" ,
315
430
shas = ["deadbaaf" ],
316
431
version = "0.0.3" ,
432
+ url = "" ,
317
433
),
318
434
target_platforms = ["cp39_osx_aarch64" ],
319
435
whls = [],
@@ -367,6 +483,7 @@ def _test_env_marker_resolution(env):
367
483
requirement_line = "bar==0.0.1 --hash=sha256:deadbeef" ,
368
484
shas = ["deadbeef" ],
369
485
version = "0.0.1" ,
486
+ url = "" ,
370
487
),
371
488
target_platforms = ["cp311_linux_super_exotic" , "cp311_windows_x86_64" ],
372
489
whls = [],
@@ -384,6 +501,7 @@ def _test_env_marker_resolution(env):
384
501
requirement_line = "foo[extra]==0.0.1 --hash=sha256:deadbeef" ,
385
502
shas = ["deadbeef" ],
386
503
version = "0.0.1" ,
504
+ url = "" ,
387
505
),
388
506
target_platforms = ["cp311_windows_x86_64" ],
389
507
whls = [],
@@ -419,6 +537,7 @@ def _test_different_package_version(env):
419
537
requirement_line = "foo==0.0.1 --hash=sha256:deadb00f" ,
420
538
shas = ["deadb00f" ],
421
539
version = "0.0.1" ,
540
+ url = "" ,
422
541
),
423
542
target_platforms = ["linux_x86_64" ],
424
543
whls = [],
@@ -434,6 +553,7 @@ def _test_different_package_version(env):
434
553
requirement_line = "foo==0.0.1+local --hash=sha256:deadbeef" ,
435
554
shas = ["deadbeef" ],
436
555
version = "0.0.1+local" ,
556
+ url = "" ,
437
557
),
438
558
target_platforms = ["linux_x86_64" ],
439
559
whls = [],
0 commit comments