mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
The pip-specific Path implementation has been removed, and all its usages replaced by pathlib.Path. The tmpdir and tmpdir_factory fixtures are also removed, and all usages are replaced by tmp_path and tmp_path_factory, which use pathlib.Path. The pip() function now also accepts pathlib.Path so we don't need to put str() everywhere. Path arguments are coerced with os.fspath() into str.
20 lines
703 B
Python
20 lines
703 B
Python
import os
|
|
|
|
from pip._internal.vcs.mercurial import Mercurial
|
|
from tests.lib import PipTestEnvironment, _create_test_package, need_mercurial
|
|
|
|
|
|
@need_mercurial
|
|
def test_get_repository_root(script: PipTestEnvironment) -> None:
|
|
version_pkg_path = _create_test_package(script, vcs="hg")
|
|
tests_path = version_pkg_path.joinpath("tests")
|
|
tests_path.mkdir()
|
|
|
|
root1 = Mercurial.get_repository_root(os.fspath(version_pkg_path))
|
|
assert root1 is not None
|
|
assert os.path.normcase(root1) == os.path.normcase(version_pkg_path)
|
|
|
|
root2 = Mercurial.get_repository_root(os.fspath(tests_path))
|
|
assert root2 is not None
|
|
assert os.path.normcase(root2) == os.path.normcase(version_pkg_path)
|