From dd86083c677a0ebb5a21a9a764e62f6ffd175ce1 Mon Sep 17 00:00:00 2001 From: Juliya Smith Date: Tue, 2 Jul 2024 14:13:10 -0500 Subject: [PATCH] test: add better integration test --- tests/conftest.py | 5 ----- tests/test_cli.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 76589955..6e72f25e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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() diff --git a/tests/test_cli.py b/tests/test_cli.py index 1e5b3ba9..e27e9293 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,3 +1,5 @@ +import subprocess + import pytest from ape.utils import create_tempdir @@ -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