Add unit tests for build and update-gh tools #162

Open
opened 2026-05-17 11:34:08 +10:00 by unkinben · 0 comments
Owner

Summary

Add a tests/ directory with pytest-based unit tests for the two main tools.

Scope

tools/build

  • effective_release() — dist tag appending logic
  • get_rpm_dist_tag() — distro-to-dist-tag mapping
  • normalize_version() — leading-zero stripping
  • normalize_github_version() — v-prefix removal
  • parse_github_version_release() — version/release splitting
  • compare_versions() — version comparison
  • check_package_exists() — mock HTTP, test 200/404/401/timeout paths
  • discover_packages() — mock filesystem, validate PackageInfo output

tools/update-gh (if applicable)

  • Version parsing and comparison helpers

Notes

  • Tests must run offline (mock all HTTP and Vault calls)
  • Pre-commit hook already wired to run pytest tests/ on Python file changes
  • Aim for coverage of pure logic functions first, integration paths second
## Summary Add a `tests/` directory with pytest-based unit tests for the two main tools. ## Scope ### `tools/build` - `effective_release()` — dist tag appending logic - `get_rpm_dist_tag()` — distro-to-dist-tag mapping - `normalize_version()` — leading-zero stripping - `normalize_github_version()` — v-prefix removal - `parse_github_version_release()` — version/release splitting - `compare_versions()` — version comparison - `check_package_exists()` — mock HTTP, test 200/404/401/timeout paths - `discover_packages()` — mock filesystem, validate PackageInfo output ### `tools/update-gh` (if applicable) - Version parsing and comparison helpers ## Notes - Tests must run offline (mock all HTTP and Vault calls) - Pre-commit hook already wired to run `pytest tests/` on Python file changes - Aim for coverage of pure logic functions first, integration paths second
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/rpmbuilder#162