File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-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,31 @@ 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
+ @pytest .fixture
61
+ def worktree_fixture ():
62
+ subprocess .check_call ([
63
+ "git" ,
64
+ "worktree" ,
65
+ "add" ,
66
+ "--detach" ,
67
+ "/tmp/font-v" ,
68
+ "HEAD^"
69
+ ])
70
+ yield
71
+ subprocess .call ([
72
+ "git" ,
73
+ "worktree" ,
74
+ "remove" ,
75
+ "/tmp/font-v" ,
76
+ ])
77
+
78
+ def test_utilities_get_gitrootpath_function_returns_proper_path_from_worktree (worktree_fixture ):
79
+ filepath = "/tmp/font-v/README.md"
80
+ gitdir_path = get_git_root_path (filepath )
81
+ assert os .path .basename (gitdir_path ) == "font-v"
82
+ assert os .path .isdir (gitdir_path ) is True
83
+
84
+
59
85
def test_utilities_get_gitrootpath_function_raises_ioerror_six_levels_up ():
60
86
with pytest .raises (IOError ):
61
87
filepath = "tests/testfiles/deepdir/deepdir2/deepdir3/deepdir4/test.txt"
You can’t perform that action at this time.
0 commit comments