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