One function
_get_package_version in Midnighter/dependency-info
The author described this change as “Fix #5, more robust package parsing”. It counts as a record because the checks below fail on the code as it stood at c20ecd151 and pass on 3a1d376a3, with nothing else changed between the two runs.
ProjectMidnighter/dependency-info
Fix saved2021-02-03
Sharing licenceApache-2.0 · LICENSE
Change size+1 −1
What the code was meant to do, written into the code itself as a docstring
Return a package, version pair from a requirement description. Raises: importlib.metadata.PackageNotFoundError: If the package is not found in the environment.
The change
| 7 | 7 | environment. | |
| 8 | 8 | ||
| 9 | 9 | """ | |
| 10 | - | package = requirement.split(";", 1)[0].strip() | |
| 10 | + | package = re.split(r"[;<>=\s]", requirement)[0] | |
| 11 | 11 | return package, version(package) |
The check that tells the two apart
fail→pass·tests/test_info.py::test_get_package_version[pip
fail→pass·tests/test_info.py::test_get_package_version[pip==1.19.3-pip]
fail→pass·tests/test_info.py::test_get_package_version[pip>=2.0.5-pip]
fail→pass·tests/test_info.py::test_get_package_version[pip>=6.1
fail→pass·tests/test_info.py::test_get_package_version[pip>=6.1;
Check file tests/test_info.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itc20ecd1515da9c29f3878797cc8b4dbc4db67809
Broken version dated2021-02-03
Moduledepinfo.info
Units changed_get_package_version
Fingerprintb1cd681b86588ac1
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.