Make test_freeze_bazaar_clone not depend on bazaar.launchpad.net

This commit is contained in:
Marc Abramowitz 2015-03-09 09:30:06 -07:00
parent 80106081de
commit 7f5566fea4
2 changed files with 21 additions and 19 deletions

View File

@ -218,41 +218,32 @@ def test_freeze_mercurial_clone(script, tmpdir):
_check_output(result, expected)
@pytest.mark.network
@pytest.mark.bzr
def test_freeze_bazaar_clone(script, tmpdir):
"""
Test freezing a Bazaar clone.
"""
checkout_path = local_checkout(
'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/'
'release-0.1',
tmpdir.join("cache"),
)
# bzr internally stores windows drives as uppercase; we'll match that.
try:
checkout_path = _create_test_package(script, vcs='bazaar')
except OSError as e:
pytest.fail('Invoking `bzr` failed: %s' % e)
checkout_pathC = checkout_path.replace('c:', 'C:')
result = script.run(
'bzr', 'checkout', '-r', '174',
local_repo(
'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/'
'release-0.1',
tmpdir.join("cache"),
),
'django-wikiapp',
'bzr', 'checkout', checkout_path, 'bzr-package'
)
result = script.run(
'python', 'setup.py', 'develop',
cwd=script.scratch_path / 'django-wikiapp',
cwd=script.scratch_path / 'bzr-package',
expect_stderr=True,
)
result = script.pip('freeze', expect_stderr=True)
expected = textwrap.dedent("""\
Script result: ...pip freeze
-- stdout: --------------------
...-e %s@...#egg=django_wikiapp-...
...""" % checkout_pathC)
...-e bzr+file://%s@1#egg=version_pkg-0.1-...
...""" % checkout_path)
_check_output(result, expected)
result = script.pip(
@ -264,7 +255,7 @@ def test_freeze_bazaar_clone(script, tmpdir):
Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp
-- stdout: --------------------
-f %(repo)s/#egg=django-wikiapp
...-e %(repoC)s@...#egg=django_wikiapp-...
...-e bzr+file://%(repoC)s@...#egg=version_pkg-...
...""" % {'repoC': checkout_pathC, 'repo': checkout_path})
_check_output(result, expected)

View File

@ -505,6 +505,17 @@ def _create_test_package(script, vcs='git'):
checkout_path = checkout_path.replace('c:', 'C:')
version_pkg_path = checkout_path
elif vcs == 'bazaar':
script.run('bzr', 'init', cwd=version_pkg_path)
script.run('bzr', 'add', '.', cwd=version_pkg_path)
script.run(
'bzr', 'whoami', 'pip <pypa-dev@googlegroups.com>',
cwd=version_pkg_path)
script.run(
'bzr', 'commit', '-q',
'--author', 'pip <pypa-dev@googlegroups.com>',
'-m', 'initial version', cwd=version_pkg_path,
)
else:
raise ValueError('Unknown vcs: %r' % vcs)
return version_pkg_path