test_freeze_svn: No dep on bitbucket

Instead of using local_checkout, which downloads a 204 KB dump file from
http://bitbucket.org/hltbra/pip-initools-dump/raw/8b55c908a320/INITools_modified.dump,
use `svnadmin create` and `svn import` to create an svn repo on the fly.
This commit is contained in:
Marc Abramowitz 2015-03-10 23:45:41 -07:00
parent e5b1d4fded
commit f4ee579304
3 changed files with 46 additions and 29 deletions

View File

@ -65,6 +65,13 @@ Ways to run the tests locally:
$ py.test # Using py.test directly
$ tox # Using tox against pip's tox.ini
If you are missing one of the VCS tools, you can tell ``py.test`` to skip it:
::
$ py.test -k 'not bzr'
$ py.test -k 'not svn'
Getting Involved
================

View File

@ -4,6 +4,7 @@ import textwrap
import pytest
from doctest import OutputChecker, ELLIPSIS
from tests.lib import _create_test_package
from tests.lib.local_repos import local_checkout, local_repo
@ -65,39 +66,23 @@ def test_freeze_basic(script):
_check_output(result, expected)
@pytest.mark.network
@pytest.mark.svn
def test_freeze_svn(script, tmpdir):
"""Test freezing a svn checkout"""
checkout_path = local_checkout(
'svn+http://svn.colorstudy.com/INITools/trunk',
tmpdir.join("cache"),
)
# svn internally stores windows drives as uppercase; we'll match that.
checkout_path = checkout_path.replace('c:', 'C:')
checkout_path = _create_test_package(script, vcs='svn')
# Checkout
script.run(
'svn', 'co', '-r10',
local_repo(
'svn+http://svn.colorstudy.com/INITools/trunk',
tmpdir.join("cache"),
),
'initools-trunk',
)
# Install with develop
script.run(
'python', 'setup.py', 'develop',
cwd=script.scratch_path / 'initools-trunk',
expect_stderr=True,
cwd=checkout_path, expect_stderr=True
)
result = script.pip('freeze', expect_stderr=True)
expected = textwrap.dedent("""\
Script result: pip freeze
-- stdout: --------------------
...-e %s@10#egg=INITools-0.3.1dev...-dev_r10
...""" % checkout_path)
...-e svn+...#egg=version_pkg-0.1-...
...""")
_check_output(result, expected)

View File

@ -458,7 +458,7 @@ setup(name='version_subpkg',
return version_pkg_path
def _create_test_package(script):
def _create_test_package(script, vcs='git'):
script.scratch_path.join("version_pkg").mkdir()
version_pkg_path = script.scratch_path / 'version_pkg'
version_pkg_path.join("version_pkg.py").write(textwrap.dedent("""
@ -475,13 +475,38 @@ def _create_test_package(script):
entry_points=dict(console_scripts=['version_pkg=version_pkg:main'])
)
"""))
script.run('git', 'init', cwd=version_pkg_path)
script.run('git', 'add', '.', cwd=version_pkg_path)
script.run(
'git', 'commit', '-q',
'--author', 'pip <pypa-dev@googlegroups.com>',
'-am', 'initial version', cwd=version_pkg_path,
)
if vcs == 'git':
script.run('git', 'init', cwd=version_pkg_path)
script.run('git', 'add', '.', cwd=version_pkg_path)
script.run(
'git', 'commit', '-q',
'--author', 'pip <pypa-dev@googlegroups.com>',
'-am', 'initial version', cwd=version_pkg_path,
)
elif vcs == 'svn':
repo_url = ('file://' +
script.scratch_path / 'pip-test-package-repo' / 'trunk')
script.run(
'svnadmin', 'create', 'pip-test-package-repo',
cwd=script.scratch_path
)
script.run(
'svn', 'import', version_pkg_path, repo_url,
'-m', 'Initial import of pip-test-package',
cwd=script.scratch_path
)
script.run(
'svn', 'checkout', repo_url, 'pip-test-package',
cwd=script.scratch_path
)
checkout_path = script.scratch_path / 'pip-test-package'
# svn internally stores windows drives as uppercase; we'll match that.
checkout_path = checkout_path.replace('c:', 'C:')
version_pkg_path = checkout_path
else:
raise ValueError('Unknown vcs: %r' % vcs)
return version_pkg_path