diff --git a/src/nile/deployments.py b/src/nile/deployments.py index fd436a41..aaabd4d8 100644 --- a/src/nile/deployments.py +++ b/src/nile/deployments.py @@ -81,10 +81,9 @@ def update_abi(address_or_alias, abi, network): identifiers = aliases if address_or_alias in identifiers: - logging.info(f"📦 Updating deployment {address_or_alias} in {file}") - # Save address as hex address = hex_address(address) + logging.info(f"📦 Updating {address} in {file}") replacement = f"{address}:{abi}" if len(aliases) > 0: replacement += ":" + ":".join(str(x) for x in aliases) diff --git a/tests/test_deployments.py b/tests/test_deployments.py index 50023fd9..034a6de7 100644 --- a/tests/test_deployments.py +++ b/tests/test_deployments.py @@ -1,9 +1,11 @@ """Tests for deployments file.""" +import logging + import pytest from nile.common import DECLARATIONS_FILENAME, DEPLOYMENTS_FILENAME from nile.deployments import register, register_class_hash, unregister, update_abi -from nile.utils import hex_class_hash, normalize_number +from nile.utils import hex_address, hex_class_hash, normalize_number LOCALHOST = "localhost" @@ -81,7 +83,7 @@ def tmp_working_dir(monkeypatch, tmp_path): ), ], ) -def test_update_deployment(address_or_alias, abi, expected_lines): +def test_update_deployment(address_or_alias, abi, expected_lines, caplog): register(normalize_number(A_ADDR), A_ABI, LOCALHOST, f"{A_ALIAS}:{A_ALIAS_ALT}") register(normalize_number(B_ADDR), B_ABI, LOCALHOST, B_ALIAS) register(normalize_number(C_ADDR), C_ABI, LOCALHOST, None) @@ -90,8 +92,16 @@ def test_update_deployment(address_or_alias, abi, expected_lines): lines = fp.readlines() assert len(lines) == 3 + # make logs visible to test + logging.getLogger().setLevel(logging.INFO) + update_abi(address_or_alias, abi, LOCALHOST) + identifier = address_or_alias + if type(address_or_alias) == int: + identifier = hex_address(address_or_alias) + assert f"Updating {identifier} in {LOCALHOST}.{DEPLOYMENTS_FILENAME}" + with open(f"{LOCALHOST}.{DEPLOYMENTS_FILENAME}", "r") as fp: lines = fp.readlines() assert len(lines) == 3