Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/pypi/tests/test_pypi.py
Show First 20 Lines • Show All 727 Lines • ▼ Show 20 Lines | |||||
def test_pypi_build_release_missing_version_in_pkg_info(swh_storage, tmp_path): | def test_pypi_build_release_missing_version_in_pkg_info(swh_storage, tmp_path): | ||||
"""Simulate release build when Version field is missing in PKG-INFO file.""" | """Simulate release build when Version field is missing in PKG-INFO file.""" | ||||
url = "https://pypi.org/project/GermlineFilter" | url = "https://pypi.org/project/GermlineFilter" | ||||
# create package info | # create package info | ||||
p_info = PyPIPackageInfo( | p_info = PyPIPackageInfo( | ||||
url=url, | url=url, | ||||
filename="GermlineFilter-1.2.tar.gz", | filename="GermlineFilter-1.2.tar.gz", | ||||
version="1.2", | |||||
directory_extrinsic_metadata=[], | directory_extrinsic_metadata=[], | ||||
raw_info={}, | raw_info={}, | ||||
comment_text="", | comment_text="", | ||||
sha256="e4982353c544d94b34f02c5690ab3d3ebc93480d5b62fe6f3317f23c515acc05", | sha256="e4982353c544d94b34f02c5690ab3d3ebc93480d5b62fe6f3317f23c515acc05", | ||||
upload_time="2015-02-18T20:39:13", | upload_time="2015-02-18T20:39:13", | ||||
) | ) | ||||
# create PKG-INFO file with missing Version field | # create PKG-INFO file with missing Version field | ||||
Show All 9 Lines | |||||
License: UNKNOWN | License: UNKNOWN | ||||
Description: UNKNOWN | Description: UNKNOWN | ||||
Platform: UNKNOWN""" | Platform: UNKNOWN""" | ||||
) | ) | ||||
directory = hash_to_bytes("8b864d66f356afe35033d58f8e03b7c23a66751f") | directory = hash_to_bytes("8b864d66f356afe35033d58f8e03b7c23a66751f") | ||||
# attempt to build release | # attempt to build release | ||||
loader = PyPILoader(swh_storage, url) | loader = PyPILoader(swh_storage, url) | ||||
release = loader.build_release("1.2", p_info, str(tmp_path), directory) | release = loader.build_release(p_info, str(tmp_path), directory) | ||||
# without comment_text and version in PKG-INFO, message should be empty | # without comment_text and version in PKG-INFO, message should be empty | ||||
assert release.message == b"" | assert release.message == b"" | ||||
def test_filter_out_invalid_sdists(swh_storage, requests_mock): | def test_filter_out_invalid_sdists(swh_storage, requests_mock): | ||||
project_name = "swh-test-sdist-filtering" | project_name = "swh-test-sdist-filtering" | ||||
version = "1.0.0" | version = "1.0.0" | ||||
Show All 32 Lines |