-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathtest_vcs.py
54 lines (38 loc) · 1.49 KB
/
test_vcs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# SPDX-FileCopyrightText: 2017 Free Software Foundation Europe e.V. <https://fsfe.org>
# SPDX-FileCopyrightText: 2022 Florian Snow <florian@familysnow.net>
# SPDX-FileCopyrightText: 2024 Skyler Grey <sky@a.starrysky.fyi>
# SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Tests for reuse.vcs"""
import os
from pathlib import Path
from reuse import vcs
def test_find_root_in_git_repo(git_repository):
"""When using reuse from a child directory in a Git repo, always find the
root directory.
"""
os.chdir("src")
result = vcs.find_root()
assert Path(result).absolute().resolve() == git_repository
def test_find_root_in_hg_repo(hg_repository):
"""When using reuse from a child directory in a Mercurial repo, always find
the root directory.
"""
os.chdir("src")
result = vcs.find_root()
assert Path(result).absolute().resolve() == hg_repository
def test_find_root_in_jujutsu_repo(jujutsu_repository):
"""When using reuse from a child directory in a Jujutsu repo, always find
the root directory.
"""
os.chdir("src")
result = vcs.find_root()
assert Path(result).absolute().resolve() == jujutsu_repository
def test_find_root_in_pijul_repo(pijul_repository):
"""When using reuse from a child directory in a Pijul repo, always find
the root directory.
"""
os.chdir("src")
result = vcs.find_root()
assert Path(result).absolute().resolve() == pijul_repository