Skip to content

Commit

Permalink
fix: issue where always would raise a warning [APE-1533]
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Nov 10, 2023
2 parents 7bf42f4 + b02b702 commit 164dabe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion solcx/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
14 changes: 14 additions & 0 deletions tests/install/test_validate_installation.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import sys
import warnings

import pytest

import solcx
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"
Expand Down

0 comments on commit 164dabe

Please sign in to comment.