File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,41 @@ def get_output(
27
27
(["g" , "--help" ], "git --help" ),
28
28
],
29
29
)
30
+ class CommandLineTestFixture (t .NamedTuple ):
31
+ """Test fixture for CLI params, environment, and expected result."""
32
+
33
+ # pytest internal
34
+ test_id : str
35
+
36
+ # test data
37
+ argv_args : t .List [str ]
38
+
39
+ # results
40
+ expect_cmd : str
41
+
42
+
43
+ TEST_FIXTURES : t .List [CommandLineTestFixture ] = [
44
+ CommandLineTestFixture (
45
+ test_id = "g-cmd-inside-git-dir" ,
46
+ argv_args = ["g" ],
47
+ expect_cmd = "git" ,
48
+ ),
49
+ CommandLineTestFixture (
50
+ test_id = "g-cmd-help-inside-git-dir" ,
51
+ argv_args = ["g --help" ],
52
+ expect_cmd = "git --help" ,
53
+ ),
54
+ ]
55
+
56
+
57
+ @pytest .mark .parametrize (
58
+ list (CommandLineTestFixture ._fields ),
59
+ TEST_FIXTURES ,
60
+ ids = [f .test_id for f in TEST_FIXTURES ],
61
+ )
30
62
def test_command_line (
31
63
# capsys: pytest.CaptureFixture[str],
64
+ test_id : str ,
32
65
argv_args : t .List [str ],
33
66
expect_cmd : str ,
34
67
) -> None :
You can’t perform that action at this time.
0 commit comments