def test_get_remote_url__no_remote(script, tmpdir): """ Test a repo with no remote. """ repo_dir = tmpdir / 'temp-repo' repo_dir.mkdir() repo_dir = str(repo_dir) script.run('git', 'init', cwd=repo_dir) with pytest.raises(RemoteNotFoundError): Git.get_remote_url(repo_dir)
def test_get_remote_url__no_remote(script, tmpdir): """ Test a repo with no remote. """ repo_dir = tmpdir / 'temp-repo' repo_dir.mkdir() repo_dir = str(repo_dir) script.run('git', 'init', cwd=repo_dir) with pytest.raises(RemoteNotFoundError): Git.get_remote_url(repo_dir)
def test_get_remote_url__no_remote(script: PipTestEnvironment, tmpdir: Path) -> None: """ Test a repo with no remote. """ repo_path = tmpdir / "temp-repo" repo_path.mkdir() repo_dir = str(repo_path) script.run("git", "init", cwd=repo_dir) with pytest.raises(RemoteNotFoundError): Git.get_remote_url(repo_dir)
def git(): git_url = 'https://github.com/pypa/pip-test-package' sha = '5547fa909e83df8bd743d3978d6667497983a4b7' git = Git() git.get_remote_url = Mock(return_value=git_url) git.get_revision = Mock(return_value=sha) return git
def test_get_remote_url(script, tmpdir): source_dir = tmpdir / 'source' source_dir.mkdir() source_url = _test_path_to_file_url(source_dir) source_dir = str(source_dir) script.run('git', 'init', cwd=source_dir) do_commit(script, source_dir) repo_dir = str(tmpdir / 'repo') script.run('git', 'clone', source_url, repo_dir) remote_url = Git.get_remote_url(repo_dir) assert remote_url == source_url
def test_get_remote_url(script, tmpdir): source_dir = tmpdir / 'source' source_dir.mkdir() source_url = _test_path_to_file_url(source_dir) source_dir = str(source_dir) script.run('git', 'init', cwd=source_dir) do_commit(script, source_dir) repo_dir = str(tmpdir / 'repo') script.run('git', 'clone', source_url, repo_dir, expect_stderr=True) remote_url = Git.get_remote_url(repo_dir) assert remote_url == source_url
def test_get_remote_url(script: PipTestEnvironment, tmpdir: Path) -> None: source_path = tmpdir / "source" source_path.mkdir() source_url = _test_path_to_file_url(source_path) source_dir = str(source_path) script.run("git", "init", cwd=source_dir) do_commit(script, source_dir) repo_dir = str(tmpdir / "repo") script.run("git", "clone", source_url, repo_dir) remote_url = Git.get_remote_url(repo_dir) assert remote_url == source_url