File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 33
44import pytest
55
6+ from libvcs ._internal .subprocess import SubprocessCommand
67from libvcs .cmd import git
78
89
@@ -11,3 +12,20 @@ def test_run(dir_type: Callable, tmp_path: pathlib.Path):
1112 repo = git .Git (dir = dir_type (tmp_path ))
1213
1314 assert repo .dir == tmp_path
15+
16+
17+ @pytest .mark .parametrize ("dir_type" , [str , pathlib .Path ])
18+ def test_run_deferred (dir_type : Callable , tmp_path : pathlib .Path ):
19+ class GitDeferred (git .Git ):
20+ def run (self , args , ** kwargs ):
21+ return SubprocessCommand (["git" , * args ], ** kwargs )
22+
23+ g = GitDeferred (dir = dir_type (tmp_path ))
24+ cmd = g .run (["help" ])
25+
26+ assert g .dir == tmp_path
27+ assert cmd .args == ["git" , "help" ]
28+
29+ assert cmd .run (capture_output = True , text = True ).stdout .startswith (
30+ "usage: git [--version] [--help] [-C <path>]"
31+ )
You can’t perform that action at this time.
0 commit comments