1

When I try to use Brownie developer revert comments with a Vyper contract as described in the Brownie documentation here:

Developer Revert Comments

Brownie does not seem to recognize the comments.

Environment information

  • brownie Version: 1.18.1
  • ganache-cli Version: 0.1.4
  • solc Version: NA
  • 'vyper' Version: 0.3.1
  • Python Version: 3.9.12
  • OS: linux Ubuntu 20.04.4

Simple example to demonstrate problem:

contract_with_assertion.vy

# @version ^0.3.0
@payable
@external


def __init__():
    assert False # dev: developer comment

test_dev_comments.py

import brownie


def test_developer_revert_comments(contract_with_assertion, accounts):
    with brownie.reverts("dev: developer comment"):
        contract_with_assertion.deploy({'from': accounts[0]})

Command: $brownie test

Output:

Brownie v1.18.1 - Python development framework for Ethereum

============================= test session starts ==============================
platform linux -- Python 3.8.10, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/alecms/test_venv/developer_comments_example
plugins: eth-brownie-1.18.1, hypothesis-6.27.3, xdist-1.34.0, web3-5.27.0, forked-1.4.0
collected 1 item                                                               

Launching 'ganache-cli --chain.vmErrorsOnRPCResponse true --server.port 8545 --miner.blockGasLimit 12000000 --wallet.totalAccounts 10 --hardfork istanbul --wallet.mnemonic brownie'...

tests/test_dev_comments.py F                                             [100%]

=================================== FAILURES ===================================
________________________ test_developer_revert_comments ________________________

contract_with_assertion = <brownie.network.contract.ContractContainer object at 0x7f52442aa1c0>
accounts = <brownie.network.account.Accounts object at 0x7f524a2b8100>

    def test_developer_revert_comments(contract_with_assertion, accounts):
        with brownie.reverts("dev: developer comment"):
>           contract_with_assertion.deploy({'from': accounts[0]})
E           AssertionError: Unexpected revert string ''

tests/test_dev_comments.py:10: AssertionError
----------------------------- Captured stdout call -----------------------------
Transaction sent: 0x7434cef807b909faf46a6d07b8804b19275e61847878c98a8acd85238ce9b444
=========================== short test summary info ============================
FAILED tests/test_dev_comments.py::test_developer_revert_comments - Assertion...
============================== 1 failed in 1.21s ===============================
Terminating local RPC client...
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.