File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 2
2
# -*- coding: utf-8 -*-
3
3
4
4
import os
5
+ import subprocess
5
6
6
7
import pytest
7
8
@@ -56,6 +57,27 @@ def test_utilities_get_gitrootpath_function_returns_proper_path_three_levels_up(
56
57
assert os .path .isdir (gitdir_path ) is True
57
58
58
59
60
+ def test_utilities_get_gitrootpath_function_returns_proper_path_from_worktree ():
61
+ subprocess .check_call ([
62
+ "git" ,
63
+ "worktree" ,
64
+ "add" ,
65
+ "--detach" ,
66
+ "/tmp/font-v" ,
67
+ "HEAD^"
68
+ ])
69
+ filepath = "/tmp/font-v/README.md"
70
+ gitdir_path = get_git_root_path (filepath )
71
+ assert os .path .basename (gitdir_path ) == "font-v"
72
+ assert os .path .isdir (gitdir_path ) is True
73
+ subprocess .call ([
74
+ "git" ,
75
+ "worktree" ,
76
+ "remove" ,
77
+ "/tmp/font-v" ,
78
+ ])
79
+
80
+
59
81
def test_utilities_get_gitrootpath_function_raises_ioerror_six_levels_up ():
60
82
with pytest .raises (IOError ):
61
83
filepath = "tests/testfiles/deepdir/deepdir2/deepdir3/deepdir4/test.txt"
You can’t perform that action at this time.
0 commit comments