From d9d21f7cfbd1eab45f47ffe2c51646e0c7b6e5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Sun, 20 Dec 2020 21:53:36 +0100 Subject: [PATCH] Adjust some tests to use the free gas strategy by name, instead of a callable --- .../interfaces/test_handle_multiversion_contracts.py | 5 ++++- tests/acceptance/blockchain/interfaces/test_testerchain.py | 5 ++++- tests/contracts/test_contracts_upgradeability.py | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/blockchain/interfaces/test_handle_multiversion_contracts.py b/tests/acceptance/blockchain/interfaces/test_handle_multiversion_contracts.py index 4624c3499..71f6eb4b7 100644 --- a/tests/acceptance/blockchain/interfaces/test_handle_multiversion_contracts.py +++ b/tests/acceptance/blockchain/interfaces/test_handle_multiversion_contracts.py @@ -24,6 +24,9 @@ from nucypher.crypto.powers import TransactingPower from tests.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.blockchain import free_gas_price_strategy +BlockchainDeployerInterface.GAS_STRATEGIES = {**BlockchainDeployerInterface.GAS_STRATEGIES, + 'free': free_gas_price_strategy} + def test_deployer_interface_multiversion_contract(): @@ -42,7 +45,7 @@ def test_deployer_interface_multiversion_contract(): # Prepare chain BlockchainInterfaceFactory._interfaces.clear() blockchain_interface = BlockchainDeployerInterface(provider_uri='tester://pyevm', - gas_strategy=free_gas_price_strategy) + gas_strategy='free') blockchain_interface.connect() BlockchainInterfaceFactory.register_interface(interface=blockchain_interface) # Lets this test run in isolation diff --git a/tests/acceptance/blockchain/interfaces/test_testerchain.py b/tests/acceptance/blockchain/interfaces/test_testerchain.py index 27f127eaa..e9869fee9 100644 --- a/tests/acceptance/blockchain/interfaces/test_testerchain.py +++ b/tests/acceptance/blockchain/interfaces/test_testerchain.py @@ -104,8 +104,11 @@ def test_multiversion_contract(): compiled_contracts = multiversion_compile(source_bundles=bundles) # Prepare chain + BlockchainDeployerInterface.GAS_STRATEGIES = {**BlockchainDeployerInterface.GAS_STRATEGIES, + 'free': free_gas_price_strategy} + blockchain_interface = BlockchainDeployerInterface(provider_uri='tester://pyevm/2', - gas_strategy=free_gas_price_strategy) + gas_strategy='free') blockchain_interface.connect(compile_now=False) blockchain_interface._raw_contract_cache = compiled_contracts diff --git a/tests/contracts/test_contracts_upgradeability.py b/tests/contracts/test_contracts_upgradeability.py index 9c98b744f..38e13e8aa 100644 --- a/tests/contracts/test_contracts_upgradeability.py +++ b/tests/contracts/test_contracts_upgradeability.py @@ -39,6 +39,10 @@ BRANCH = "main" GITHUB_SOURCE_LINK = f"https://api.github.com/repos/{USER}/{REPO}/contents/nucypher/blockchain/eth/sol/source?ref={BRANCH}" +BlockchainDeployerInterface.GAS_STRATEGIES = {**BlockchainDeployerInterface.GAS_STRATEGIES, + 'free': free_gas_price_strategy} + + def download_github_dir(source_link: str, target_folder: str): response = requests.get(source_link) if response.status_code != 200: @@ -110,7 +114,7 @@ def test_upgradeability(temp_dir_path): provider_uri = 'tester://pyevm/2' # TODO: Testerchain caching Issues try: blockchain_interface = BlockchainDeployerInterface(provider_uri=provider_uri, - gas_strategy=free_gas_price_strategy) + gas_strategy='free') blockchain_interface.connect() origin = blockchain_interface.client.accounts[0] BlockchainInterfaceFactory.register_interface(interface=blockchain_interface)