Skip to content

Commit 544cd21

Browse files
committed
add tests for sdist handling
1 parent 900dabb commit 544cd21

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

python/private/pypi/parse_requirements.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def _add_dists(*, requirement, index_urls, logger = None):
307307
if filename.endswith(".whl"):
308308
return [direct_url_dist], None
309309
else:
310-
return None, direct_url_dist
310+
return [], direct_url_dist
311311

312312
if not index_urls:
313313
return [], None

tests/pypi/parse_requirements/parse_requirements_tests.bzl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ foo==0.0.1 \
2929
foo[extra] @ https://some-url/package.whl
3030
bar @ https://example.org/bar-1.0.whl --hash=sha256:deadbeef
3131
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
3233
""",
3334
"requirements_extra_args": """\
3435
--index-url=example.org
@@ -204,6 +205,29 @@ def _test_direct_urls(env):
204205
)],
205206
),
206207
],
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+
],
207231
})
208232

209233
_tests.append(_test_direct_urls)

0 commit comments

Comments
 (0)