I am using brownie to run tests and right now my project is using two networks, development and mainnet-fork. I have a test which only runs in mainnet-fork and I am trying to figure out a way to tell brownie that the test shouldn't be run when I execute:

brownie test -s --coverage --network development

is there a way to do that?

  • 1
    Unfortuantely this isn't easy to do right now with Brownie. I've opened an issue to request the feature though! Feel free to leave feedback on the potential syntax. github.com/eth-brownie/brownie/issues/810 Oct 15, 2020 at 2:59
  • @iamdefinitelyahuman can you answer with that link so I can mark the question as answered?
    – Macarse
    Oct 19, 2020 at 16:03

1 Answer 1


As of v1.12.0 this is possible using the require_network marker:


Mark a test so that it only runs if the active network is named network_name. This is useful when you have some tests intended for a local development environment and others for a forked mainnet.

For example, to make a test only execute when using a forked mainnet:

import pytest

def test_almost_in_prod():
  • for some reason this still connects to the default network
    – KIC
    Mar 31, 2022 at 18:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.