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 22# -*- coding: utf-8 -*-
33
44import os
5+ import subprocess
56
67import pytest
78
@@ -56,6 +57,27 @@ def test_utilities_get_gitrootpath_function_returns_proper_path_three_levels_up(
5657 assert os .path .isdir (gitdir_path ) is True
5758
5859
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+
5981def test_utilities_get_gitrootpath_function_raises_ioerror_six_levels_up ():
6082 with pytest .raises (IOError ):
6183 filepath = "tests/testfiles/deepdir/deepdir2/deepdir3/deepdir4/test.txt"
You can’t perform that action at this time.
0 commit comments