tests.test_pypi moduleΒΆ

Tests for PyPI client helpers.

tests.test_pypi.test_github_repo_root(url, expected)[source]ΒΆ
tests.test_pypi.test_get_source_url_matches_keys_case_insensitively()[source]ΒΆ

A lowercase homepage key 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_reduces_a_sub_path_to_the_repo_root()[source]ΒΆ

Even the value-scan fallback yields a slug the releases API accepts.

tests.test_pypi.test_get_source_url_none_without_a_github_url()[source]ΒΆ
tests.test_pypi.test_latest_release_file_picks_most_recent_wheel()[source]ΒΆ

Pick the wheel from the version with the most recent earliest upload.

tests.test_pypi.test_latest_release_file_falls_back_to_sdist()[source]ΒΆ

Fall back to the sdist when no wheel exists for the latest release.

tests.test_pypi.test_latest_release_file_skips_yanked_versions()[source]ΒΆ

Yanked-only versions do not count as the latest release.

tests.test_pypi.test_latest_release_file_no_releases()[source]ΒΆ

Return None when the package has no releases at all.

tests.test_pypi.test_latest_release_file_api_failure()[source]ΒΆ

Return None when the metadata fetch itself failed.

tests.test_pypi.test_release_dates_capture_yank_reason()[source]ΒΆ

The first non-empty per-file yank reason rides along with the release.

tests.test_pypi.test_get_trusted_publishers_match()[source]ΒΆ

Parse a single GitHub publisher bundle into a TrustedPublisher tuple.

tests.test_pypi.test_get_trusted_publishers_empty_bundles()[source]ΒΆ

Return an empty list when provenance exists but lists no bundles.

tests.test_pypi.test_get_trusted_publishers_network_failure()[source]ΒΆ

Return None on URL or network errors.

tests.test_pypi.test_get_trusted_publishers_invalid_json()[source]ΒΆ

Return None when the response body cannot be parsed.

tests.test_pypi.test_get_trusted_publishers_retries_incomplete_read()[source]ΒΆ

A truncated provenance body is retried before the lookup gives up.

tests.test_pypi.test_get_trusted_publishers_skips_malformed_entries()[source]ΒΆ

Skip bundles whose publisher object is missing required fields.

tests.test_pypi.test_settings_url_bare_without_prefill_args()[source]ΒΆ

No keyword args returns the bare settings URL.

tests.test_pypi.test_settings_url_prefill_query(kwargs, expected_query)[source]ΒΆ

Provided GitHub fields produce a ?provider=github&… prefill suffix.

Return type:

None

tests.test_pypi.test_settings_url_prefill_skips_blank_fields()[source]ΒΆ

Empty-string fields are dropped from the prefill query.

tests.test_pypi.test_settings_url_url_encodes_unsafe_characters()[source]ΒΆ

Special characters in field values are URL-encoded.