Skip to content

test_freeze_mercurial_clone: no dep on bitbucket #2525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 15 additions & 32 deletions tests/functional/test_freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from doctest import OutputChecker, ELLIPSIS

from tests.lib import _create_test_package
from tests.lib.local_repos import local_checkout, local_repo


distribute_re = re.compile('^distribute==[0-9.]+\n', re.MULTILINE)
Expand Down Expand Up @@ -156,64 +155,48 @@ def test_freeze_git_clone(script, tmpdir):
_check_output(result, expected)


@pytest.mark.network
@pytest.mark.mercurial
def test_freeze_mercurial_clone(script, tmpdir):
"""
Test freezing a Mercurial clone.

"""
# Returns path to a generated package called "version_pkg"
pkg_version = _create_test_package(script, vcs='hg')

result = script.run(
'hg', 'clone',
'-r', 'c9963c111e7c',
local_repo(
'hg+http://bitbucket.org/pypa/pip-test-package',
tmpdir.join("cache"),
),
'pip-test-package',
'hg', 'clone', pkg_version, 'pip-test-package',
expect_stderr=True,
)
repo_dir = script.scratch_path / 'pip-test-package'
result = script.run(
'python', 'setup.py', 'develop',
cwd=script.scratch_path / 'pip-test-package',
cwd=repo_dir,
expect_stderr=True,
)
result = script.pip('freeze', expect_stderr=True)
expected = textwrap.dedent(
"""
Script result: ...pip freeze
-- stdout: --------------------
...-e %s@...#egg=pip_test_package-...
...-e hg+...#egg=version_pkg-dev
...
""" %
local_checkout(
'hg+http://bitbucket.org/pypa/pip-test-package',
tmpdir.join("cache"),
),
"""
).strip()
_check_output(result, expected)

result = script.pip(
'freeze', '-f',
'%s#egg=pip_test_package' %
local_checkout(
'hg+http://bitbucket.org/pypa/pip-test-package',
tmpdir.join("cache"),
),
'freeze', '-f', '%s#egg=pip_test_package' % repo_dir,
expect_stderr=True,
)
expected = textwrap.dedent(
"""
Script result: ...pip freeze -f %(repo)s#egg=pip_test_package
Script result: pip freeze -f %(repo)s#egg=pip_test_package
-- stdout: --------------------
-f %(repo)s#egg=pip_test_package
...-e %(repo)s@...#egg=pip_test_package-dev
-f %(repo)s#egg=pip_test_package...
...-e hg+...#egg=version_pkg-dev
...
""" %
{
'repo': local_checkout(
'hg+http://bitbucket.org/pypa/pip-test-package',
tmpdir.join("cache"),
),
},
""" % {'repo': repo_dir},
).strip()
_check_output(result, expected)

Expand Down
8 changes: 8 additions & 0 deletions tests/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,14 @@ def main():
'--author', 'pip <[email protected]>',
'-am', 'initial version', cwd=version_pkg_path,
)
elif vcs == 'hg':
script.run('hg', 'init', cwd=version_pkg_path)
script.run('hg', 'add', '.', cwd=version_pkg_path)
script.run(
'hg', 'commit', '-q',
'--user', 'pip <[email protected]>',
'-m', 'initial version', cwd=version_pkg_path,
)
elif vcs == 'svn':
repo_url = ('file://' +
script.scratch_path / 'pip-test-package-repo' / 'trunk')
Expand Down