2019-01-07 00:49:16 +01:00
|
|
|
"""
|
|
|
|
Contains functional tests of the Bazaar class.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
2021-08-28 23:20:38 +02:00
|
|
|
import sys
|
2022-06-07 11:52:38 +02:00
|
|
|
from pathlib import Path
|
2019-01-07 00:49:16 +01:00
|
|
|
|
2019-01-21 23:42:41 +01:00
|
|
|
import pytest
|
|
|
|
|
2019-01-07 00:49:16 +01:00
|
|
|
from pip._internal.vcs.bazaar import Bazaar
|
2020-12-25 20:24:38 +01:00
|
|
|
from pip._internal.vcs.versioncontrol import RemoteNotFoundError
|
2021-09-13 00:31:12 +02:00
|
|
|
from tests.lib import PipTestEnvironment, is_bzr_installed, need_bzr
|
2019-01-21 23:42:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skipif(
|
2021-08-28 23:20:38 +02:00
|
|
|
sys.platform == "win32" or "CI" not in os.environ,
|
|
|
|
reason="Bazaar is only required under CI",
|
2021-08-08 00:23:54 +02:00
|
|
|
)
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_ensure_bzr_available() -> None:
|
2021-08-28 23:20:38 +02:00
|
|
|
"""Make sure that bzr is available when running in CI."""
|
2019-01-21 23:42:41 +01:00
|
|
|
assert is_bzr_installed()
|
2019-01-07 00:49:16 +01:00
|
|
|
|
|
|
|
|
2020-12-25 20:24:38 +01:00
|
|
|
@need_bzr
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_get_remote_url__no_remote(script: PipTestEnvironment, tmpdir: Path) -> None:
|
2021-08-08 00:23:54 +02:00
|
|
|
repo_dir = tmpdir / "temp-repo"
|
2020-12-25 20:24:38 +01:00
|
|
|
repo_dir.mkdir()
|
|
|
|
|
2022-06-07 11:52:38 +02:00
|
|
|
script.run("bzr", "init", os.fspath(repo_dir))
|
2020-12-25 20:24:38 +01:00
|
|
|
|
|
|
|
with pytest.raises(RemoteNotFoundError):
|
2022-06-07 11:52:38 +02:00
|
|
|
Bazaar().get_remote_url(os.fspath(repo_dir))
|