File: test_vcs.py

package info (click to toggle)
reuse 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,316 kB
  • sloc: python: 9,646; makefile: 80; sh: 6; ansic: 5
file content (54 lines) | stat: -rw-r--r-- 1,527 bytes parent folder | download
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