swev-id: astropy__astropy-7671 Fix minversion failures with LooseVersion dev comparisons#98
swev-id: astropy__astropy-7671 Fix minversion failures with LooseVersion dev comparisons#98casey-brooks wants to merge 2 commits intoastropy__astropy-7671from
Conversation
Test & Lint Summary
|
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for improving the LooseVersion fallback and adding coverage. I did spot one functional regression: normalization currently slices the release components down to three entries, so any 4+ segment version collapses when the fallback path runs. For example, minversion(_module_with_version('1.2.3.4.dev1'), '1.2.3.5.dev1') now returns True even though the required version is newer. Please keep all release segments (while still padding missing ones) and add a regression test for a four-component release. Happy to take another look once that’s in place.
Test & Lint Summary
|
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for addressing the normalization regression so quickly. The updated helper preserves every release component, the sentinel keeps tag metadata distinct, and the new multi-component dev test exercises the edge case I flagged. Everything else looks solid and the expanded test matrix covers the tricky tag ordering. LGTM.
Summary
_normalize_for_loose_versionto strip epochs/local tags and encode prerelease/dev/post tags into dotted numeric segmentsminversionignores distutils deprecation warnings and falls back to normalized comparisons whenever tagged versions are involved or LooseVersion raisesTypeErrorastropy/utils/tests/test_introspection.pywith coverage for dev, prerelease, post-release, epoch, and local-version casesTesting
.venv/bin/flake8 astropy/utils/introspection.py astropy/utils/tests/test_introspection.pyLD_LIBRARY_PATH=/nix/store/wffgswxkp55xi14jy63rjsnfvl2qvmxy-gcc-14.3.0-lib/lib:/nix/store/qipd93x9gjyiygqk673rd2ssnf8y7jj0-gcc-14.3.0-lib/lib:/nix/store/zmjqwzhgl9hwr8xnk8raj8d50lzkql66-gcc-14.3.0-lib/lib:/nix/store/n5lymg0y5x6i9wipkjrsi8aczv1nr4qc-zlib-1.3.1/lib PYTHONPATH=/tmp/pycompat:/workspace/astropy/.venv/lib/python3.10/site-packages:. .venv/bin/python -m pytest astropy/utils/tests/test_introspection.py -k minversion -p no:cacheproviderObserved failure
Reproduction
Fixes #91