def test_export_rev(script, tmpdir): """Test that a Bazaar branch can be exported, specifying a rev.""" source_dir = tmpdir / 'test-source' source_dir.mkdir() # Create a single file that is changed by two revisions. create_file(source_dir / 'test_file', 'something initial') _vcs_add(script, str(source_dir), vcs='bazaar') create_file(source_dir / 'test_file', 'something new') script.run( 'bzr', 'commit', '-q', '--author', 'pip <*****@*****.**>', '-m', 'change test file', cwd=source_dir, ) export_dir = tmpdir / 'export' url = hide_url('bzr+' + _test_path_to_file_url(source_dir) + '@1') Bazaar().export(str(export_dir), url=url) with open(export_dir / 'test_file', 'r') as f: assert f.read() == 'something initial'
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_export(script, tmpdir): """Test that a Bazaar branch can be exported.""" source_dir = tmpdir / 'test-source' source_dir.mkdir() create_file(source_dir / 'test_file', 'something') _vcs_add(script, str(source_dir), vcs='bazaar') export_dir = str(tmpdir / 'export') url = hide_url('bzr+' + _test_path_to_file_url(source_dir)) Bazaar().export(export_dir, url=url) assert os.listdir(export_dir) == ['test_file']
def _make_version_pkg_url(path, rev=None, name="version_pkg"): """ Return a "git+file://" URL to the version_pkg test package. Args: path: a tests.lib.path.Path object pointing to a Git repository containing the version_pkg package. rev: an optional revision to install like a branch name, tag, or SHA. """ file_url = _test_path_to_file_url(path) url_rev = '' if rev is None else '@{}'.format(rev) url = 'git+{}{}#egg={}'.format(file_url, url_rev, name) return 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_export(script, tmpdir): """Test that a Bazaar branch can be exported.""" source_dir = tmpdir / 'test-source' source_dir.mkdir() create_file(source_dir / 'test_file', 'something') _vcs_add(script, str(source_dir), vcs='bazaar') export_dir = str(tmpdir / 'export') url = 'bzr+' + _test_path_to_file_url(source_dir) Bazaar().export(export_dir, url=url) assert os.listdir(export_dir) == ['test_file']
def _make_version_pkg_url(path, rev=None): """ Return a "git+file://" URL to the version_pkg test package. Args: path: a tests.lib.path.Path object pointing to a Git repository containing the version_pkg package. rev: an optional revision to install like a branch name, tag, or SHA. """ file_url = _test_path_to_file_url(path) url_rev = '' if rev is None else '@{}'.format(rev) url = 'git+{}{}#egg=version_pkg'.format(file_url, url_rev) return 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
def _make_version_pkg_url( path: Path, rev: Optional[str] = None, name: str = "version_pkg" ) -> str: """ Return a "git+file://" URL to the version_pkg test package. Args: path: a tests.lib.path.Path object pointing to a Git repository containing the version_pkg package. rev: an optional revision to install like a branch name, tag, or SHA. """ file_url = _test_path_to_file_url(path) url_rev = "" if rev is None else f"@{rev}" url = f"git+{file_url}{url_rev}#egg={name}" return url
def test_export_rev(script, tmpdir): """Test that a Bazaar branch can be exported, specifying a rev.""" source_dir = tmpdir / 'test-source' source_dir.mkdir() # Create a single file that is changed by two revisions. create_file(source_dir / 'test_file', 'something initial') _vcs_add(script, str(source_dir), vcs='bazaar') create_file(source_dir / 'test_file', 'something new') script.run( 'bzr', 'commit', '-q', '--author', 'pip <*****@*****.**>', '-m', 'change test file', cwd=source_dir, ) export_dir = tmpdir / 'export' url = 'bzr+' + _test_path_to_file_url(source_dir) + '@1' Bazaar().export(str(export_dir), url=url) with open(export_dir / 'test_file', 'r') as f: assert f.read() == 'something initial'