示例#1
0
文件: test_vcs.py 项目: cjc7373/pip
def test_paths_are_not_mistaken_for_scp_shorthand(url, platform):
    # File paths should not be mistaken for SCP shorthand. If they do then
    # 'c:/piffle/wiffle' would end up as 'ssh://c/piffle/wiffle'.
    from pip._internal.vcs.git import SCP_REGEX
    assert not SCP_REGEX.match(url)

    if platform == os.name:
        with pytest.raises(RemoteNotValidError):
            Git._git_remote_to_pip_url(url)
示例#2
0
文件: test_vcs.py 项目: cjc7373/pip
def test_git_get_src_requirements(
    mock_get_subdirectory, mock_get_revision, mock_get_remote_url,
        git_url, target_url_prefix,
):
    sha = '5547fa909e83df8bd743d3978d6667497983a4b7'

    mock_get_remote_url.return_value = Git._git_remote_to_pip_url(git_url)
    mock_get_revision.return_value = sha
    mock_get_subdirectory.return_value = None

    ret = Git.get_src_requirement('.', 'pip-test-package')

    target = f"{target_url_prefix}@{sha}#egg=pip_test_package"
    assert ret == target
示例#3
0
def test_git_get_src_requirements(
    mock_get_subdirectory: mock.Mock,
    mock_get_revision: mock.Mock,
    mock_get_remote_url: mock.Mock,
    git_url: str,
    target_url_prefix: str,
) -> None:
    sha = "5547fa909e83df8bd743d3978d6667497983a4b7"

    mock_get_remote_url.return_value = Git._git_remote_to_pip_url(git_url)
    mock_get_revision.return_value = sha
    mock_get_subdirectory.return_value = None

    ret = Git.get_src_requirement(".", "pip-test-package")

    target = f"{target_url_prefix}@{sha}#egg=pip_test_package"
    assert ret == target
示例#4
0
def test_git_remote_local_path(tmpdir: pathlib.Path) -> None:
    path = pathlib.Path(tmpdir, "project.git")
    path.mkdir()
    # Path must exist to be recognised as a local git remote.
    assert Git._git_remote_to_pip_url(str(path)) == path.as_uri()
示例#5
0
def test_git_remote_url_to_pip(url: str, target: str) -> None:
    assert Git._git_remote_to_pip_url(url) == target
示例#6
0
文件: test_vcs.py 项目: cjc7373/pip
def test_git_remote_url_to_pip(url, target):
    assert Git._git_remote_to_pip_url(url) == target