|
3 | 3 | All examples can be run with the CPPython entry-point, and we use the examples as the test data for the CLI. |
4 | 4 | """ |
5 | 5 |
|
6 | | -import shutil |
7 | 6 | from pathlib import Path |
8 | 7 |
|
9 | | -from typer.testing import CliRunner |
10 | | - |
11 | | -from cppython.console.entry import app |
12 | | - |
13 | | -runner = CliRunner() |
14 | 8 | pytest_plugins = ['tests.fixtures.example'] |
15 | 9 |
|
16 | 10 |
|
17 | 11 | class TestExamples: |
18 | | - """Verifies the examples are accessible""" |
| 12 | + """Tests to apply to all examples""" |
19 | 13 |
|
20 | 14 | @staticmethod |
21 | 15 | def test_example_directory(example_directory: Path) -> None: |
22 | 16 | """Verify that the fixture is returning the right data""" |
23 | 17 | assert example_directory.is_dir() |
24 | 18 | 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 |
0 commit comments