2020-01-15 10:50:41 +01:00
|
|
|
import os
|
|
|
|
|
2020-01-14 09:45:28 +01:00
|
|
|
from pip._internal.vcs.mercurial import Mercurial
|
2020-01-14 11:00:49 +01:00
|
|
|
from tests.lib import _create_test_package, need_mercurial
|
2020-01-14 09:45:28 +01:00
|
|
|
|
|
|
|
|
2020-01-14 11:00:49 +01:00
|
|
|
@need_mercurial
|
2020-01-14 09:45:28 +01:00
|
|
|
def test_get_repository_root(script):
|
|
|
|
version_pkg_path = _create_test_package(script, vcs="hg")
|
|
|
|
tests_path = version_pkg_path.joinpath("tests")
|
|
|
|
tests_path.mkdir()
|
|
|
|
|
|
|
|
root1 = Mercurial.get_repository_root(version_pkg_path)
|
2020-01-15 10:50:41 +01:00
|
|
|
assert os.path.normcase(root1) == os.path.normcase(version_pkg_path)
|
2020-01-14 09:45:28 +01:00
|
|
|
|
|
|
|
root2 = Mercurial.get_repository_root(version_pkg_path.joinpath("tests"))
|
2020-01-15 10:50:41 +01:00
|
|
|
assert os.path.normcase(root2) == os.path.normcase(version_pkg_path)
|