Skip to content

test: dedupe source helpers and cover inherited cooldown - #1465

Open
qiaobochi040726-source wants to merge 1 commit into
python-wheel-build:mainfrom
qiaobochi040726-source:20261112-test-cleanups
Open

qiaobochi040726-source wants to merge 1 commit into
python-wheel-build:mainfrom
qiaobochi040726-source:20261112-test-cleanups

Conversation

@qiaobochi040726-source

Copy link
Copy Markdown

Moved the three copies of _configure_package() / _source_yaml() into conftest, so the hook-prebuilt schema rule only gets maintained in one place. Added a test for a source: package without min_release_age, which should fall back to the global --min-release-age.

Asserting the whole GitLab server URL turned up a real bug: the port came out as None when project_url had no explicit port, so it now defaults to 443. The bug fix is the one line in _resolver.py; everything else is tests.

pytest tests/ before and after: same 38 failures both ways (Windows: git VCS URLs with backslash paths, sys.abiflags), plus the new test passing. ruff and mypy are clean apart from the same pre-existing windows errors.

closes #1424

…ooldown

Move _configure_package() and _source_yaml() from three test modules into
conftest so the hook-prebuilt schema rule only lives in one place. Add a
case for a source: package with no min_release_age, which should fall back
to the global --min-release-age. Also assert the whole GitLab server URL,
which turned up a real bug: the port came out as 'None' when project_url
had no explicit port, so default it to 443.

Signed-off-by: qiaobochi040726-source <qiaobochi040726-source@users.noreply.github.com>
@qiaobochi040726-source
qiaobochi040726-source requested a review from a team as a code owner November 12, 2026 12:54
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The resolver now uses port 443 in a GitLab server URL when the project URL has no explicit port. Tests assert the complete URL, verify global minimum release age for a source-configured package, and use shared source test helpers from conftest.py.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: Minimal · up to 782b5

This change sets a default HTTPS port for GitLab server URLs and improves test coverage and helper reuse. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "test: dedupe source helpers and cover inherited cooldown" names the two main changes: moving duplicated helpers into conftest and adding a test for the inherited min_release_age cooldown. I…
Description check Passed The description matches the changeset. It explains moving _configure_package() and _source_yaml() into conftest, the new test for source packages without min_release_age, and the GitLab port bug fix i…
Linked Issues check Passed Issue #1424 has three coding requirements. (1) Move _configure_package() and _source_yaml() into tests/conftest.py: the diff adds both helpers to tests/conftest.py with the same `hook-prebuilt…
Out of Scope Changes check Passed All changes map to the three objectives of #1424. The only non-test source change is the one-line port default in _resolver.py. It is needed for the full-URL assertion required by objective 3, and t…
Full details: Title check

Explanation

The title "test: dedupe source helpers and cover inherited cooldown" names the two main changes: moving duplicated helpers into conftest and adding a test for the inherited min_release_age cooldown. It does not mention the one-line GitLab port bug fix in _resolver.py, which is a partial omission but not off-topic. The title is specific and concise.

Full details: Description check

Explanation

The description matches the changeset. It explains moving _configure_package() and _source_yaml() into conftest, the new test for source packages without min_release_age, and the GitLab port bug fix in _resolver.py. It also reports test results and links issue #1424.

Full details: Linked Issues check

Explanation

Issue #1424 has three coding requirements. (1) Move _configure_package() and _source_yaml() into tests/conftest.py: the diff adds both helpers to tests/conftest.py with the same hook-prebuilt index_url rule, and the summary reports that tests/test_commands.py, tests/test_wheels.py, and tests/test_bootstrapper.py import them instead of defining local copies. (2) Add a cooldown-inheritance test: the summary reports test_list_versions_source_inherits_global_min_release_age in tests/test_list_versions.py, which covers a source: package without min_release_age using the global three-day cooldown. (3) Assert the full GitLab URL https://gitlab.test:443: tests/test_packagesettings_resolver.py now asserts the full value. The assertion needs the code fix. In src/fromager/packagesettings/_resolver.py, server_url now uses self.project_url.port or 443, which replaces the previous None output when no port is given. The test-side changes were inspected only through the summary, not through a full test diff. The _resolver.py and conftest.py hunks were read directly and match the summary.

Full details: Out of Scope Changes check

Explanation

All changes map to the three objectives of #1424. The only non-test source change is the one-line port default in _resolver.py. It is needed for the full-URL assertion required by objective 3, and the issue names https://gitlab.test:None as the failure to prevent. The PR text calls this a bug fix, while the issue states no behavior changes. This is a minor wording mismatch, not an out-of-scope change. No unrelated files are reported in the summary.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 20d29aa and 782b508.

Files selected for processing: 7

  • src/fromager/packagesettings/_resolver.py
  • tests/conftest.py
  • tests/test_bootstrapper.py
  • tests/test_commands.py
  • tests/test_list_versions.py
  • tests/test_packagesettings_resolver.py
  • tests/test_wheels.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@mergify mergify Bot added the ci label Nov 12, 2026
@mergify

mergify Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

@LalatenduMohanty

Copy link
Copy Markdown
Member

Thanks! The test cleanups look good. A few changes:

  • Please drop the _resolver.py change. For https URLs, pydantic.HttpUrl already reports port 443 when none is given (checked on 2.12.0 and 2.13.5). The new assertions pass without it.
  • Please remove the "real bug" wording from the commit message and PR body.
  • Nit: rename the shared helpers without the underscore (like make_sbom_ctx), and shorten the commit subject to 72 characters or less.

@LalatenduMohanty LalatenduMohanty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes per my comment above: #1465 (comment)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test cleanups from the #1414 review

2 participants