Skip to content

Commit 2b2dff2

Browse files
committed
Ye
1 parent 3ef8e13 commit 2b2dff2

File tree

2 files changed

+43
-52
lines changed

2 files changed

+43
-52
lines changed
Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,57 @@
11
"""Example folder tests"""
22

3+
import shutil
34
from pathlib import Path
45

6+
from typer.testing import CliRunner
7+
8+
from cppython.console.entry import app
9+
10+
runner = CliRunner()
511
pytest_plugins = ['tests.fixtures.example']
612

713

814
class TestExamples:
9-
"""Tests to apply to all examples"""
15+
"""Verifies the examples are accessible"""
1016

1117
@staticmethod
1218
def test_example_directory(example_directory: Path) -> None:
1319
"""Verify that the fixture is returning the right data"""
1420
assert example_directory.is_dir()
1521
assert (example_directory / 'pyproject.toml').is_file()
22+
23+
@staticmethod
24+
def test_info(example_directory: Path) -> None:
25+
"""Verifies that the info command functions with CPPython hooks"""
26+
with runner.isolated_filesystem() as temp_directory:
27+
shutil.copytree(example_directory, temp_directory, dirs_exist_ok=True)
28+
29+
result = runner.invoke(app, ['info'])
30+
assert result.exit_code == 0
31+
32+
@staticmethod
33+
def test_list(example_directory: Path) -> None:
34+
"""Verifies that the list command functions with CPPython hooks"""
35+
with runner.isolated_filesystem() as temp_directory:
36+
shutil.copytree(example_directory, temp_directory, dirs_exist_ok=True)
37+
38+
result = runner.invoke(app, ['list'])
39+
assert result.exit_code == 0
40+
41+
@staticmethod
42+
def test_update(example_directory: Path) -> None:
43+
"""Verifies that the update command functions with CPPython hooks"""
44+
with runner.isolated_filesystem() as temp_directory:
45+
shutil.copytree(example_directory, temp_directory, dirs_exist_ok=True)
46+
47+
result = runner.invoke(app, ['update'])
48+
assert result.exit_code == 0
49+
50+
@staticmethod
51+
def test_install(example_directory: Path) -> None:
52+
"""Verifies that the install command functions with CPPython hooks"""
53+
with runner.isolated_filesystem() as temp_directory:
54+
shutil.copytree(example_directory, temp_directory, dirs_exist_ok=True)
55+
56+
result = runner.invoke(app, ['install'])
57+
assert result.exit_code == 0

tests/unit/test_console.py

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)