Skip to content

Commit

Permalink
Fix mypy for local chain tests (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzii authored Aug 28, 2024
1 parent 74c7e0f commit 410e8fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 4 additions & 1 deletion tests_integration_with_local_chain/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
)
10 changes: 8 additions & 2 deletions tests_integration_with_local_chain/markets/omen/test_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 410e8fc

Please sign in to comment.