From f08333c046a3e7e64f1bc34bc50775ec374c4ec9 Mon Sep 17 00:00:00 2001 From: Daniel Schiavini Date: Tue, 17 Sep 2024 17:37:19 +0200 Subject: [PATCH] Reintroduce variables --- tests/test_versioning.py | 3 ++- vvm/utils/versioning.py | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_versioning.py b/tests/test_versioning.py index d3d90c6..efa6653 100644 --- a/tests/test_versioning.py +++ b/tests/test_versioning.py @@ -58,6 +58,7 @@ def test_npm_version_for_04_release(): with pytest.raises(UnexpectedVersionError) as excinfo: detect_vyper_version_from_source("# pragma version ^0.4.1") - assert str(excinfo.value) == ( + expected_msg = ( "Please use the pypi-style version specifier for vyper versions >= 0.4.0 (hint: ~=0.4.1)" ) + assert str(excinfo.value) == expected_msg diff --git a/vvm/utils/versioning.py b/vvm/utils/versioning.py index ba5f957..adc4277 100644 --- a/vvm/utils/versioning.py +++ b/vvm/utils/versioning.py @@ -32,10 +32,8 @@ def _detect_version_specifier(source_code: str) -> Specifier: specifier, version_str = match.groups() if specifier in ("~", "^"): # convert from npm-style to pypi-style if Version(version_str) >= Version("0.4.0"): - raise UnexpectedVersionError( - f"Please use the pypi-style version specifier " - f"for vyper versions >= 0.4.0 (hint: ~={version_str})" - ) + error = f"Please use the pypi-style version specifier for vyper versions >= 0.4.0 (hint: ~={version_str})" + raise UnexpectedVersionError(error) # for v0.x, both specifiers are equivalent specifier = "~=" # finds compatible versions