From 7541d6e449d0eb005d9c8e808d8dc23421edd442 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Tue, 17 May 2022 04:47:14 -0400 Subject: [PATCH] fix(test): pytest workflow (#1) * 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 ace9e12fa7c476370881edfb9b494000ead66f8c. * fix: reattempt_call_and_return_exception --- .github/workflows/pytest.yaml | 9 ++++----- tests/test_brownie_patch.py | 13 ++++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 644b9ce6..f0cb85e8 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -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 \ No newline at end of file diff --git a/tests/test_brownie_patch.py b/tests/test_brownie_patch.py index baa6ea44..c985d713 100644 --- a/tests/test_brownie_patch.py +++ b/tests/test_brownie_patch.py @@ -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