Skip to content

Commit b56de55

Browse files
committed
Catch DeprecationWarning in test
1 parent 5f13ddb commit b56de55

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/core/contracts/test_contract_deployment.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,20 @@ def test_contract_deployment_with_constructor_without_args(web3,
4141
def test_contract_deployment_with_constructor_with_arguments(web3,
4242
WithConstructorArgumentsContract,
4343
WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME):
44-
deploy_txn = WithConstructorArgumentsContract.constructor(1234, 'abcd').transact()
44+
with pytest.warns(
45+
DeprecationWarning,
46+
match='in v6 it will be invalid to pass a hexstring without the "0x" prefix'
47+
):
48+
deploy_txn = WithConstructorArgumentsContract.constructor(1234, 'abcd').transact()
4549

46-
txn_receipt = web3.eth.waitForTransactionReceipt(deploy_txn)
47-
assert txn_receipt is not None
50+
txn_receipt = web3.eth.waitForTransactionReceipt(deploy_txn)
51+
assert txn_receipt is not None
4852

49-
assert txn_receipt['contractAddress']
50-
contract_address = txn_receipt['contractAddress']
53+
assert txn_receipt['contractAddress']
54+
contract_address = txn_receipt['contractAddress']
5155

52-
blockchain_code = web3.eth.getCode(contract_address)
53-
assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME)
56+
blockchain_code = web3.eth.getCode(contract_address)
57+
assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME)
5458

5559

5660
def test_contract_deployment_with_constructor_with_address_argument(web3,

0 commit comments

Comments
 (0)