diff --git a/solcx/install.py b/solcx/install.py index e6abdf1..5267a7e 100644 --- a/solcx/install.py +++ b/solcx/install.py @@ -709,7 +709,7 @@ def _validate_installation(version: Version, solcx_binary_path: Union[Path, str, raise UnexpectedVersionError( f"Attempted to install solc v{version}, but got solc v{installed_version}" ) - if installed_version_clean not in (version.base_version, f"{version}"): + if installed_version not in (version.base_version, f"{version}"): # If it does have the nightly suffix, then only warn. warnings.warn( f"Installed solc version is v{installed_version}, expecting v{version.base_version}", diff --git a/tests/install/test_validate_installation.py b/tests/install/test_validate_installation.py index 49525b6..ca5c98c 100644 --- a/tests/install/test_validate_installation.py +++ b/tests/install/test_validate_installation.py @@ -1,4 +1,5 @@ import sys +import warnings import pytest @@ -6,6 +7,19 @@ from solcx.exceptions import SolcInstallationError, UnexpectedVersionError, UnexpectedVersionWarning +def test_validate_installation(mocker, install_mock, solc_binary, install_path): + version = solcx.wrapper.get_solc_version(solc_binary) + version_str_patch = mocker.patch("solcx.wrapper.get_version_str_from_solc_binary") + version_str_patch.return_value = f"{version}" + + # This should not warn! + with warnings.catch_warnings(): + warnings.simplefilter("error") + solcx.install_solc() + + assert install_path.exists() + + def test_validate_installation_wrong_version(mocker, install_mock, install_path): patch = mocker.patch("solcx.wrapper.get_version_str_from_solc_binary") patch.return_value = "0.0.0"