tests.test_pypi moduleΒΆ
Tests for PyPI client helpers.
- tests.test_pypi.test_get_changelog_url(project_urls, expected)ΒΆ
The first changelog-like key wins, with its trailing slash dropped.
- tests.test_pypi.test_get_source_url_matches_keys_case_insensitively()ΒΆ
A lowercase
homepagekey must not fall through to the value scan.PyPI preserves whatever spelling a project wrote. A case-sensitive miss used to drop through to the βany github.com valueβ fallback and return whichever URL came first, which for these packages is the bug tracker.
- tests.test_pypi.test_get_source_url_none_without_a_github_url()ΒΆ
- tests.test_pypi.test_get_source_url_reduces_a_sub_path_to_the_repo_root()ΒΆ
Even the value-scan fallback yields a slug the releases API accepts.
- tests.test_pypi.test_get_trusted_publishers_empty_bundles()ΒΆ
Return an empty list when provenance exists but lists no bundles.
- tests.test_pypi.test_get_trusted_publishers_invalid_json()ΒΆ
Return None when the response body cannot be parsed.
- tests.test_pypi.test_get_trusted_publishers_match()ΒΆ
Parse a single GitHub publisher bundle into a TrustedPublisher tuple.
- tests.test_pypi.test_get_trusted_publishers_network_failure()ΒΆ
Return None on URL or network errors.
- tests.test_pypi.test_get_trusted_publishers_retries_incomplete_read()ΒΆ
A truncated provenance body is retried before the lookup gives up.
- tests.test_pypi.test_get_trusted_publishers_skips_bundles_of_the_wrong_shape()ΒΆ
Skip bundles and publishers that are no object; drop a non-string environment.
- tests.test_pypi.test_get_trusted_publishers_skips_malformed_entries()ΒΆ
Skip bundles whose publisher object is missing required fields.
- tests.test_pypi.test_latest_release_file_api_failure()ΒΆ
Return None when the metadata fetch itself failed.
- tests.test_pypi.test_latest_release_file_falls_back_to_sdist()ΒΆ
Fall back to the sdist when no wheel exists for the latest release.
- tests.test_pypi.test_latest_release_file_no_releases()ΒΆ
Return None when the package has no releases at all.
- tests.test_pypi.test_latest_release_file_picks_most_recent_wheel()ΒΆ
Pick the wheel from the version with the most recent earliest upload.
- tests.test_pypi.test_latest_release_file_skips_yanked_versions()ΒΆ
Yanked-only versions do not count as the latest release.
- tests.test_pypi.test_release_dates_capture_yank_reason()ΒΆ
The first non-empty per-file yank reason rides along with the release.
- tests.test_pypi.test_release_wheel_none(payload)ΒΆ
No wheel with both a URL and a digest leaves nothing to download.
- tests.test_pypi.test_release_wheel_skips_the_sdist()ΒΆ
The wheel is picked whatever its rank, with the digest PyPI records.
- tests.test_pypi.test_sdist_name_version_rejects(tmp_path, names, message)ΒΆ
- tests.test_pypi.test_sdist_name_version_splits_on_the_last_hyphen(tmp_path)ΒΆ
A normalized name holds no hyphen, so the last one splits it off.
- tests.test_pypi.test_settings_url_bare_without_prefill_args()ΒΆ
No keyword args returns the bare settings URL.
- tests.test_pypi.test_settings_url_prefill_query(kwargs, expected_query)ΒΆ
Provided GitHub fields produce a
?provider=github&β¦prefill suffix.- Return type:
- tests.test_pypi.test_settings_url_prefill_skips_blank_fields()ΒΆ
Empty-string fields are dropped from the prefill query.
- tests.test_pypi.test_settings_url_url_encodes_unsafe_characters()ΒΆ
Special characters in field values are URL-encoded.
- tests.test_pypi.test_wait_for_release_gives_up_without_a_last_wait()ΒΆ
- tests.test_pypi.test_wait_for_release_polls_until_the_version_answers()ΒΆ
Each lookup reads the version endpoint afresh, waiting between two.
- tests.test_pypi.test_wait_pypi_cli(tmp_path, answers, exit_code, message)ΒΆ
The command reads the release off the sdist and reports how it went.