File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import pytest
5
5
6
+ from libvcs ._internal .subprocess import SubprocessCommand
6
7
from libvcs .cmd import git
7
8
8
9
@@ -11,3 +12,20 @@ def test_run(dir_type: Callable, tmp_path: pathlib.Path):
11
12
repo = git .Git (dir = dir_type (tmp_path ))
12
13
13
14
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