Skip to content

Migrate RPM version comparison tests to vers test schema #166 - #218

Open
AradhyaTiwari10 wants to merge 1 commit into
aboutcode-org:mainfrom
AradhyaTiwari10:migrate-rpm-tests-to-vers-schema
Open

AradhyaTiwari10 wants to merge 1 commit into
aboutcode-org:mainfrom
AradhyaTiwari10:migrate-rpm-tests-to-vers-schema

Conversation

@AradhyaTiwari10

Copy link
Copy Markdown

Fixes #166

Migrates the RPM version comparison tests to the vers test schema, following the same pattern as the Gentoo, Alpine, Arch Linux and NuGet tests.

Changes

  • New tests/data/schema/rpm_version_cmp.json with the 103 RPMVERCMP(...) cases from tests/data/rpmvercmp.at (rpm's upstream tests/rpmvercmp.at): 0 results become equality cases, -1/1 results become comparison cases whose expected output is the sorted pair, all with input_scheme: "rpm".
  • The 12 cases that upstream comments out with dnl (the RhBug:811992 and non-ASCII "oddities") are kept, since the current suite also runs them, and their description marks them as upstream oddities.
  • tests/test_rpm_vercmp.py now parametrizes over the JSON with a SchemaDrivenVersTest subclass using univers.versions.RpmVersion, replacing the m4 parser and the dynamically generated test methods.

Not changed

  • tests/test_rpm.py stays as is: it tests the structured (epoch, version, release) API of univers.rpm, and one of its cases (1::2>-3 vs 1:-2--3) cannot be written as a version string.
  • tests/data/rpmvercmp.at and its .ABOUT/.NOTICE are kept for provenance. Happy to remove them if you prefer the JSON to be the only copy.

Verification

  • Before switching, I checked that univers.versions.RpmVersion returns the same result as the old string-level univers.rpm.vercmp() on all 103 cases.
  • pytest tests/test_rpm_vercmp.py: 103 passed. Swapping in GenericVersion makes 34 of them fail, so the cases do exercise RPM ordering.
  • Full pytest tests on Python 3.11: 7268 passed. The only failures, test_versions.py::test_semver_version and test_enhanced_semantic_version, fail the same way on unmodified main.
  • black -l 100 and isort checks pass.

…g#166

Convert the RPMVERCMP cases from tests/data/rpmvercmp.at into
tests/data/schema/rpm_version_cmp.json and run them through
SchemaDrivenVersTest with univers.versions.RpmVersion, like the other
ecosystem tests. The cases commented out upstream with "dnl" are kept,
as before, and labelled as upstream oddities in their description.

Reference: aboutcode-org#166
Signed-off-by: Aradhya Tiwari <82563152+AradhyaTiwari10@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate Red Hat tests to VERS test schema

2 participants