pull/1757/head
webthethird 2 years ago
parent 701c8f3770
commit a035d271e0
  1. 12
      tests/test_upgradeability_util.py

@ -1,5 +1,6 @@
import os import os
import json import json
import re
from solc_select import solc_select from solc_select import solc_select
from deepdiff import DeepDiff from deepdiff import DeepDiff
@ -13,6 +14,7 @@ SLITHER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
UPGRADE_TEST_ROOT = os.path.join(SLITHER_ROOT, "tests", "upgradeability-util") UPGRADE_TEST_ROOT = os.path.join(SLITHER_ROOT, "tests", "upgradeability-util")
# pylint: disable=too-many-locals
def test_upgrades_compare() -> None: def test_upgrades_compare() -> None:
solc_select.switch_global_version("0.8.2", always_install=True) solc_select.switch_global_version("0.8.2", always_install=True)
@ -20,10 +22,10 @@ def test_upgrades_compare() -> None:
v1 = sl.get_contract_from_name("ContractV1")[0] v1 = sl.get_contract_from_name("ContractV1")[0]
v2 = sl.get_contract_from_name("ContractV2")[0] v2 = sl.get_contract_from_name("ContractV2")[0]
diff = compare(v1, v2) diff = compare(v1, v2)
for key in diff.keys(): for key, lst in diff.items():
if len(diff[key]) > 0: if len(lst) > 0:
print(f' * {str(key).replace("-", " ")}:') print(f' * {str(key).replace("-", " ")}:')
for obj in diff[key]: for obj in lst:
if isinstance(obj, StateVariable): if isinstance(obj, StateVariable):
print(f" * {obj.full_name}") print(f" * {obj.full_name}")
elif isinstance(obj, Function): elif isinstance(obj, Function):
@ -64,7 +66,3 @@ def diff_to_json_str(diff: dict) -> str:
elif isinstance(obj, Function): elif isinstance(obj, Function):
out[key].append(obj.signature_str) out[key].append(obj.signature_str)
return str(out).replace("'", '"') return str(out).replace("'", '"')
def __main__():
test_upgradeability_util()

Loading…
Cancel
Save