1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
pip/tests/functional/test_vcs_bazaar.py
Tzu-ping Chung 42359a9605 Migrate tests to use pathlib.Path
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.
2022-06-08 19:58:46 +08:00

33 lines
862 B
Python

"""
Contains functional tests of the Bazaar class.
"""
import os
import sys
from pathlib import Path
import pytest
from pip._internal.vcs.bazaar import Bazaar
from pip._internal.vcs.versioncontrol import RemoteNotFoundError
from tests.lib import PipTestEnvironment, is_bzr_installed, need_bzr
@pytest.mark.skipif(
sys.platform == "win32" or "CI" not in os.environ,
reason="Bazaar is only required under CI",
)
def test_ensure_bzr_available() -> None:
"""Make sure that bzr is available when running in CI."""
assert is_bzr_installed()
@need_bzr
def test_get_remote_url__no_remote(script: PipTestEnvironment, tmpdir: Path) -> None:
repo_dir = tmpdir / "temp-repo"
repo_dir.mkdir()
script.run("bzr", "init", os.fspath(repo_dir))
with pytest.raises(RemoteNotFoundError):
Bazaar().get_remote_url(os.fspath(repo_dir))