Skip to content

Commit

Permalink
test: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Nov 6, 2024
1 parent 81548db commit 750e7e3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/functional/test_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest

from ape.exceptions import ConfigError
from ape.pytest.config import ConfigWrapper
from ape.pytest.runners import PytestApeRunner
from ape_test import ApeTestConfig
from ape_test._watch import run_with_observer
Expand All @@ -18,6 +19,32 @@ def test_balance_set_from_currency_str(self):
assert actual == expected


class TestConfigWrapper:
def test_verbosity(self, mocker):
"""
Show it returns the same as pytest_config's.
"""
pytest_cfg = mocker.MagicMock()
pytest_cfg.option.verbose = False
wrapper = ConfigWrapper(pytest_cfg)
assert wrapper.verbosity is False

def test_verbosity_when_no_capture(self, mocker):
"""
Shows we enable verbose output when no-capture is set.
"""

def get_opt(name: str):
return "no" if name == "capture" else None

pytest_cfg = mocker.MagicMock()
pytest_cfg.option.verbose = False # Start off as False
pytest_cfg.getoption.side_effect = get_opt

wrapper = ConfigWrapper(pytest_cfg)
assert wrapper.verbosity is True


def test_connect_to_mainnet_by_default(mocker):
"""
Tests the condition where mainnet is configured as the default network
Expand Down

0 comments on commit 750e7e3

Please sign in to comment.