Skip to content

Commit

Permalink
fix(test): pytest workflow (#1)
Browse files Browse the repository at this point in the history
* fix(test): pytest workflow

* fix(test): install dependencies and dev dependencies together

* fix(test): remove continue-on-error: true

* fix(test): fix env var name

* temp: pytest workflow fail after one error

* fix(test): use Contract.from_explorer instead of Contract in tests

* fix(test): use ETHERSCAN_TOKEN for testing

* Revert "temp: pytest workflow fail after one error"

This reverts commit ace9e12.

* fix: reattempt_call_and_return_exception
  • Loading branch information
BobTheBuidler authored May 17, 2022
1 parent cb16e2a commit 7541d6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,16 @@ jobs:

- name: Install dependencies
run: |
pip install -r requirements-dev.txt
pip install -r requirements.txt
pip install -r requirements.txt -r requirements-dev.txt
- name: Setup brownie networks
run: |
brownie networks modify mainnet host=${{ secrets[WEB3_PROVIDER] }}
brownie networks modify mainnet host=${{ secrets.WEB3_PROVIDER }}
continue-on-error: true

- name: Run test suite
env:
BROWNIE_NETWORK: mainnet
PYTEST_NETWORK: mainnet
ETHERSCAN_TOKEN: ${{ secrets.ETHERSCAN_TOKEN }}
run: pytest
continue-on-error: true

13 changes: 8 additions & 5 deletions tests/test_brownie_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,31 @@

from tests.fixtures import dank_w3


def test_patch_call():
weth = Contract('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2')
# must use from_explorer for gh testing workflow
weth = Contract.from_explorer('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2')
_patch_call(weth.totalSupply, dank_w3)
assert hasattr(weth.totalSupply, 'coroutine')
assert await_awaitable(weth.totalSupply.coroutine(block_identifier=13_000_000)) == 6620041514474872981393155

# TODO implement this test once _patch_tx is implemented
#def test_patch_tx():
# uni_v3_quoter = Contract('0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6')
# must use from_explorer for gh testing workflow
# uni_v3_quoter = Contract.from_explorer('0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6')
# _patch_tx(uni_v3_quoter.quoteExactInput, dank_w3)
# assert hasattr(uni_v3_quoter.quoteExactInput, 'coroutine')
# assert await_awaitable(uni_v3_quoter.quoteExactInput.coroutine(block_identifier=13_000_000)) == 0

def test_patch_contract():
# ContractCall
weth = patch_contract(Contract('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'), dank_w3)
# must use from_explorer for gh testing workflow
weth = patch_contract(Contract.from_explorer('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'), dank_w3)
assert hasattr(weth.totalSupply, 'coroutine')
assert await_awaitable(weth.totalSupply.coroutine(block_identifier=13_000_000)) == 6620041514474872981393155

# ContractTx
# TODO implement this part of the test once _patch_tx is implemented
#uni_v3_quoter = patch_contract(Contract('0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6'), dank_w3)
# must use from_explorer for gh testing workflow
#uni_v3_quoter = patch_contract(Contract.from_explorer('0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6'), dank_w3)
#assert hasattr(uni_v3_quoter.quoteExactInput, 'coroutine')
#assert await_awaitable(uni_v3_quoter.quoteExactInput.coroutine(block_identifier=13_000_000)) == 0

0 comments on commit 7541d6e

Please sign in to comment.