From 410e8fcfc426095836dba24a3edde222ef1cd852 Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Wed, 28 Aug 2024 11:42:01 +0200 Subject: [PATCH] Fix mypy for local chain tests (#361) --- mypy.ini | 2 +- tests_integration_with_local_chain/conftest.py | 5 ++++- .../markets/omen/test_contract.py | 10 ++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/mypy.ini b/mypy.ini index 13261f67..af098a5b 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,6 +1,6 @@ [mypy] python_version = 3.10 -files = prediction_market_agent_tooling/, tests/, tests_integration/, examples/, scripts/ +files = prediction_market_agent_tooling/, tests/, tests_integration/, tests_integration_with_local_chain/, examples/, scripts/ plugins = pydantic.mypy warn_redundant_casts = True warn_unused_ignores = True diff --git a/tests_integration_with_local_chain/conftest.py b/tests_integration_with_local_chain/conftest.py index 92f50d0b..55fed91c 100644 --- a/tests_integration_with_local_chain/conftest.py +++ b/tests_integration_with_local_chain/conftest.py @@ -8,6 +8,7 @@ from web3 import Web3 from prediction_market_agent_tooling.config import APIKeys +from prediction_market_agent_tooling.gtypes import private_key_type @pytest.fixture(autouse=True, scope="session") @@ -37,4 +38,6 @@ def test_keys(accounts: list[TestAccount]) -> APIKeys: account = accounts[0] # Using a standard Anvil account with enough xDAI. - return APIKeys(BET_FROM_PRIVATE_KEY=account.private_key, SAFE_ADDRESS=None) + return APIKeys( + BET_FROM_PRIVATE_KEY=private_key_type(account.private_key), SAFE_ADDRESS=None + ) diff --git a/tests_integration_with_local_chain/markets/omen/test_contract.py b/tests_integration_with_local_chain/markets/omen/test_contract.py index 015a804b..90253f91 100644 --- a/tests_integration_with_local_chain/markets/omen/test_contract.py +++ b/tests_integration_with_local_chain/markets/omen/test_contract.py @@ -5,7 +5,11 @@ from web3 import Web3 from prediction_market_agent_tooling.config import APIKeys -from prediction_market_agent_tooling.gtypes import ChecksumAddress, xDai +from prediction_market_agent_tooling.gtypes import ( + ChecksumAddress, + private_key_type, + xDai, +) from prediction_market_agent_tooling.markets.omen.omen_contracts import ( WrappedxDaiContract, sDaiContract, @@ -110,7 +114,9 @@ def test_wont_retry(local_web3: Web3, accounts: list[TestAccount]) -> None: start_time = time.time() with pytest.raises(Exception) as e: WrappedxDaiContract().transferFrom( - api_keys=APIKeys(BET_FROM_PRIVATE_KEY=from_account.private_key), + api_keys=APIKeys( + BET_FROM_PRIVATE_KEY=private_key_type(from_account.private_key) + ), sender=Web3.to_checksum_address(from_account.address), recipient=Web3.to_checksum_address(to_account.address), amount_wei=value,