Commit 642ba6d
committed
Add failing test for marker eval on versions
This commit adds test cases to cover version-to-version and
non-version-to-version marker evaluation, according to PEP 508,
Environment Markers. https://peps.python.org/pep-0508/#environment-markers
Marker evaluation currently throws an InvalidVersion error when the rhs
is a valid version but the lhs is not. For example, consider the
dependency:
> Requires-Dist: typing-extensions (>=4,<5) ; extra == "v8"
The extra name "v8" is both a valid version and extra name. During
evaluation of this requirement, the LHS of the marker can take on the
value "", or some other extra name, which are not valid versions.
When this situation occurs, the comparison fails by throwing
InvalidVersion, rather then returning False. This is causing pip to
crash when attempting to install a package with such a requirement.
Currently, just one of these added cases is failing - the
"quux" == "v8" case.
I've also added two cases to document the (perhaps surprising) behaviour
that is a result of the PEP 508 spec requiring normalized version
comparison to apply to extras when both sides are valid versions.1 parent 71f38d8 commit 642ba6d
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
| |||
0 commit comments