'Brownie test pass but also throw an error

I am writing test for deployed contract on Rinkeby, here is my simple test file

from brownie import accounts, network, MyContract

from scripts.utils import get_account

contractAddress = '0x...'
def test_swapExactDtToDt():
    contract = MyContract.at(contractAddress)

And then I ran

brownie test tests/test_file.py --pdb --network rinkeby

The test pass but also throw an error KeyError: contractAddress which make me confused



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source