Commit ea353ae8 by Sébastien Eustace

Fix dev constraint parsing

Fixes #206
parent 91b4f2fe
......@@ -119,6 +119,9 @@ def parse_single_constraint(constraint): # type: (str) -> VersionConstraint
op = m.group(1)
version = m.group(2)
if version == "dev":
version = "0.0-dev"
try:
version = Version.parse(version)
except ValueError:
......
......@@ -15,5 +15,5 @@ TILDE_CONSTRAINT = re.compile("(?i)^~(?!=)({})$".format(_COMPLETE_VERSION))
TILDE_PEP440_CONSTRAINT = re.compile("(?i)^~=({})$".format(_COMPLETE_VERSION))
X_CONSTRAINT = re.compile("^(!=|==)?\s*v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.[xX*])+$")
BASIC_CONSTRAINT = re.compile(
"(?i)^(<>|!=|>=?|<=?|==?)?\s*({})".format(_COMPLETE_VERSION)
"(?i)^(<>|!=|>=?|<=?|==?)?\s*({}|dev)".format(_COMPLETE_VERSION)
)
......@@ -24,6 +24,7 @@ from poetry.semver import VersionUnion
("=1.0", Version(1, 0, 0)),
("1.2.3b5", Version(1, 2, 3, "b5")),
(">= 1.2.3", VersionRange(min=Version(1, 2, 3), include_min=True)),
(">dev", VersionRange(min=Version(0, 0, pre="dev"))), # Issue 206
],
)
def test_parse_constraint(input, constraint):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment