mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
Added a test for failing get_root_dir inside the git folder
This commit is contained in:
parent
c43698e942
commit
0d9f2d1466
1 changed files with 7 additions and 0 deletions
|
|
@ -19,6 +19,13 @@ def test_get_root_deeper(in_git_dir):
|
||||||
assert os.path.normcase(git.get_root()) == expected
|
assert os.path.normcase(git.get_root()) == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_root_in_git_sub_dir(in_git_dir):
|
||||||
|
expected = os.path.normcase(in_git_dir.strpath)
|
||||||
|
with pytest.raises(FatalError):
|
||||||
|
with in_git_dir.join('.git/objects').ensure_dir().as_cwd():
|
||||||
|
assert os.path.normcase(git.get_root()) == expected
|
||||||
|
|
||||||
|
|
||||||
def test_in_exactly_dot_git(in_git_dir):
|
def test_in_exactly_dot_git(in_git_dir):
|
||||||
with in_git_dir.join('.git').as_cwd(), pytest.raises(FatalError):
|
with in_git_dir.join('.git').as_cwd(), pytest.raises(FatalError):
|
||||||
git.get_root()
|
git.get_root()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue