Skip to content

Commit

Permalink
test: add better integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Jul 2, 2024
1 parent 9d867bb commit dd86083
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 0 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ def all_versions():
return ALL_VERSIONS


@pytest.fixture
def cli_runner():
return CliRunner()


def _get_tb_contract(version: str, project, account):
project.load_contracts()

Expand Down
15 changes: 15 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import subprocess

import pytest
from ape.utils import create_tempdir

Expand Down Expand Up @@ -31,3 +33,16 @@ def test_cli_flatten(project, contract_name, expected, cli_runner):
output = file.read_text()
for expect in expected:
assert expect in output


def test_compile():
"""
Integration: Testing the CLI using an actual subprocess because
it is the only way to test compiling the project such that it
isn't treated as a tempdir project.
"""
# Use a couple contracts
cmd_ls = ("ape", "compile", "subdir", "--force")
completed_process = subprocess.run(cmd_ls, capture_output=True)
assert "SUCCESS" in completed_process.stdout
assert "zero_four_in_subdir.vy" in completed_process.stdout

0 comments on commit dd86083

Please sign in to comment.