Skip to content

Commit

Permalink
Catch DeprecationWarning in test
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Aug 21, 2019
1 parent 4c83213 commit 6c9f050
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/core/contracts/test_contract_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@ def test_contract_deployment_with_constructor_without_args(web3,
def test_contract_deployment_with_constructor_with_arguments(web3,
WithConstructorArgumentsContract,
WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME):
deploy_txn = WithConstructorArgumentsContract.constructor(1234, 'abcd').transact()
with pytest.warns(
DeprecationWarning,
match='in v6 it will be invalid to pass a hexstring without the "0x" prefix'
):
deploy_txn = WithConstructorArgumentsContract.constructor(1234, 'abcd').transact()

txn_receipt = web3.eth.waitForTransactionReceipt(deploy_txn)
assert txn_receipt is not None
txn_receipt = web3.eth.waitForTransactionReceipt(deploy_txn)
assert txn_receipt is not None

assert txn_receipt['contractAddress']
contract_address = txn_receipt['contractAddress']
assert txn_receipt['contractAddress']
contract_address = txn_receipt['contractAddress']

blockchain_code = web3.eth.getCode(contract_address)
assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME)
blockchain_code = web3.eth.getCode(contract_address)
assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME)


def test_contract_deployment_with_constructor_with_address_argument(web3,
Expand Down

0 comments on commit 6c9f050

Please sign in to comment.