-
Notifications
You must be signed in to change notification settings - Fork 76
/
test_debug_info.py
43 lines (36 loc) · 1.24 KB
/
test_debug_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pytest
from click.testing import CliRunner
from GANDLF.entrypoints.debug_info import new_way, old_way
from . import CliCase, run_test_case
# This function is a place where a real logic is executed.
# For tests, we replace it with mock up, and check if this function is called
# with proper args for different cli commands
MOCK_PATH = "GANDLF.entrypoints.debug_info._debug_info"
OLD_SCRIPT_NAME = "gandlf_debugInfo"
# subcommand is trivial, we just check both new_way and old_way run successfully
test_file_system = []
test_cases = [
CliCase(
should_succeed=True,
new_way_lines=[""],
old_way_lines=[""],
expected_args={"verbose": False},
),
CliCase(
should_succeed=True,
new_way_lines=["--verbose", "-v"],
old_way_lines=["--verbose", "-v"],
expected_args={"verbose": True},
),
]
@pytest.mark.parametrize("case", test_cases)
def test_case(cli_runner: CliRunner, case: CliCase):
run_test_case(
cli_runner=cli_runner,
file_system_config=test_file_system,
case=case,
real_code_function_path=MOCK_PATH,
new_way=new_way,
old_way=old_way,
old_script_name=OLD_SCRIPT_NAME,
)