Skip to content

Commit 221e6ce

Browse files
committed
Revert "Ye"
This reverts commit 2b2dff2.
1 parent f425a40 commit 221e6ce

File tree

2 files changed

+52
-43
lines changed

2 files changed

+52
-43
lines changed

tests/integration/examples/test_examples.py

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,16 @@
33
All examples can be run with the CPPython entry-point, and we use the examples as the test data for the CLI.
44
"""
55

6-
import shutil
76
from pathlib import Path
87

9-
from typer.testing import CliRunner
10-
11-
from cppython.console.entry import app
12-
13-
runner = CliRunner()
148
pytest_plugins = ['tests.fixtures.example']
159

1610

1711
class TestExamples:
18-
"""Verifies the examples are accessible"""
12+
"""Tests to apply to all examples"""
1913

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

tests/unit/test_console.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""Tests the typer interface type"""
2+
3+
import shutil
4+
from pathlib import Path
5+
6+
from typer.testing import CliRunner
7+
8+
from cppython.console.entry import app
9+
10+
runner = CliRunner()
11+
pytest_plugins = ['tests.fixtures.example']
12+
13+
14+
class TestConsole:
15+
"""Various that all the examples are accessible to cppython"""
16+
17+
@staticmethod
18+
def test_info(example_directory: Path) -> None:
19+
"""Verifies that the info command functions with CPPython hooks"""
20+
with runner.isolated_filesystem() as temp_directory:
21+
shutil.copytree(example_directory, temp_directory, dirs_exist_ok=True)
22+
23+
result = runner.invoke(app, ['info'])
24+
assert result.exit_code == 0
25+
26+
@staticmethod
27+
def test_list(example_directory: Path) -> None:
28+
"""Verifies that the list command functions with CPPython hooks"""
29+
with runner.isolated_filesystem() as temp_directory:
30+
shutil.copytree(example_directory, temp_directory, dirs_exist_ok=True)
31+
32+
result = runner.invoke(app, ['list'])
33+
assert result.exit_code == 0
34+
35+
@staticmethod
36+
def test_update(example_directory: Path) -> None:
37+
"""Verifies that the update command functions with CPPython hooks"""
38+
with runner.isolated_filesystem() as temp_directory:
39+
shutil.copytree(example_directory, temp_directory, dirs_exist_ok=True)
40+
41+
result = runner.invoke(app, ['update'])
42+
assert result.exit_code == 0
43+
44+
@staticmethod
45+
def test_install(example_directory: Path) -> None:
46+
"""Verifies that the install command functions with CPPython hooks"""
47+
with runner.isolated_filesystem() as temp_directory:
48+
shutil.copytree(example_directory, temp_directory, dirs_exist_ok=True)
49+
50+
result = runner.invoke(app, ['install'])
51+
assert result.exit_code == 0

0 commit comments

Comments
 (0)