Beispiel #1
0
def test_freeze_mercurial_clone():
    """
    Test freezing a Mercurial clone.

    """
    reset_env()
    env = get_env()
    result = env.run('hg', 'clone',
                     '-r', 'f8f7eaf275c5',
                     local_repo('hg+http://bitbucket.org/jezdez/django-dbtemplates'),
                     'django-dbtemplates')
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path/'django-dbtemplates')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %s@...#egg=django_dbtemplates-...
        ...""" % local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates'))
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s#egg=django_dbtemplates' % local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s#egg=django_dbtemplates
        -- stdout: --------------------
        -f %(repo)s#egg=django_dbtemplates
        -e %(repo)s@...#egg=django_dbtemplates-...
        ...""" % {'repo': local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates')})
    _check_output(result, expected)
Beispiel #2
0
def test_freeze_bazaar_clone():
    """
    Test freezing a Bazaar clone.

    """
    reset_env()
    env = get_env()
    result = env.run('bzr', 'checkout', '-r', '174',
                     local_repo('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'),
                     'django-wikiapp')
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path/'django-wikiapp')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %s@...#egg=django_wikiapp-...
        ...""" % local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'))
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s/#egg=django-wikiapp' %
                     local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp
        -- stdout: --------------------
        -f %(repo)s/#egg=django-wikiapp
        -e %(repo)s@...#egg=django_wikiapp-...
        ...""" % {'repo':
                  local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1')})
    _check_output(result, expected)
Beispiel #3
0
def test_editable_no_install_followed_by_no_download():
    """
    Test installing an editable in two steps (first with --no-install, then with --no-download).
    """
    reset_env()

    result = run_pip(
        'install',
        '-e',
        '%s#egg=initools-dev' %
        local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
        '--no-install',
        expect_error=True)
    result.assert_installed('INITools',
                            without_egg_link=True,
                            with_files=['.svn'])

    result = run_pip(
        'install',
        '-e',
        '%s#egg=initools-dev' %
        local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
        '--no-download',
        expect_error=True)
    result.assert_installed('INITools', without_files=[curdir, '.svn'])
Beispiel #4
0
def test_freeze_git_clone():
    """
    Test freezing a Git clone.

    """
    env = reset_env()
    result = env.run('git', 'clone', local_repo('git+http://github.com/jezdez/django-pagination.git'), 'django-pagination')
    result = env.run('git', 'checkout', '1df6507872d73ee387eb375428eafbfc253dfcd8',
            cwd=env.scratch_path/'django-pagination', expect_stderr=True)
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path / 'django-pagination')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %s@...#egg=django_pagination-...
        ...""" % local_checkout('git+http://github.com/jezdez/django-pagination.git'))
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s#egg=django_pagination' % local_checkout('git+http://github.com/jezdez/django-pagination.git'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: pip freeze -f %(repo)s#egg=django_pagination
        -- stdout: --------------------
        -f %(repo)s#egg=django_pagination
        -e %(repo)s@...#egg=django_pagination-...-dev
        ...""" % {'repo': local_checkout('git+http://github.com/jezdez/django-pagination.git')})
    _check_output(result, expected)
Beispiel #5
0
def test_cleanup_after_create_bundle():
    """
    Test clean up after making a bundle. Make sure (build|src)-bundle/ dirs are removed but not src/.

    """
    env = reset_env()
    # Install an editable to create a src/ dir.
    run_pip(
        'install', '-e', '%s#egg=django-feedutil' %
        local_checkout('git+http://github.com/jezdez/django-feedutil.git'))
    build = env.venv_path / "build"
    src = env.venv_path / "src"
    assert not exists(build), "build/ dir still exists: %s" % build
    assert exists(src), "expected src/ dir doesn't exist: %s" % src

    # Make the bundle.
    fspkg = 'file://%s/FSPkg' % join(here, 'packages')
    pkg_lines = textwrap.dedent(
        '''\
            -e %s
            -e %s#egg=initools-dev
            pip''' %
        (fspkg,
         local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    write_file('bundle-req.txt', pkg_lines)
    run_pip('bundle', '-r', 'bundle-req.txt', 'test.pybundle')
    build_bundle = env.scratch_path / "build-bundle"
    src_bundle = env.scratch_path / "src-bundle"
    assert not exists(
        build_bundle), "build-bundle/ dir still exists: %s" % build_bundle
    assert not exists(
        src_bundle), "src-bundle/ dir still exists: %s" % src_bundle

    # Make sure previously created src/ from editable still exists
    assert exists(src), "expected src dir doesn't exist: %s" % src
Beispiel #6
0
def test_uninstall_from_reqs_file():
    """
    Test uninstall from a requirements file.

    """
    env = reset_env()
    write_file('test-req.txt', textwrap.dedent("""\
        -e %s#egg=initools-dev
        # and something else to test out:
        PyLogo<0.4
        """ % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    result = run_pip('install', '-r', 'test-req.txt')
    write_file('test-req.txt', textwrap.dedent("""\
        # -f, -i, and --extra-index-url should all be ignored by uninstall
        -f http://www.example.com
        -i http://www.example.com
        --extra-index-url http://www.example.com

        -e %s#egg=initools-dev
        # and something else to test out:
        PyLogo<0.4
        """ % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    result2 = run_pip('uninstall', '-r', 'test-req.txt', '-y')
    assert_all_changes(
        result, result2, [env.venv/'build', env.venv/'src', env.scratch/'test-req.txt'])
Beispiel #7
0
def test_cleanup_after_create_bundle():
    """
    Test clean up after making a bundle. Make sure (build|src)-bundle/ dirs are removed but not src/.

    """
    env = reset_env()
    # Install an editable to create a src/ dir.
    run_pip('install', '-e',
            '%s#egg=django-feedutil' %
            local_checkout('git+http://github.com/jezdez/django-feedutil.git'))
    build = env.venv_path/"build"
    src = env.venv_path/"src"
    assert not exists(build), "build/ dir still exists: %s" % build
    assert exists(src), "expected src/ dir doesn't exist: %s" % src

    # Make the bundle.
    fspkg = 'file://%s/FSPkg' %join(here, 'packages')
    pkg_lines = textwrap.dedent('''\
            -e %s
            -e %s#egg=initools-dev
            pip''' % (fspkg, local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    write_file('bundle-req.txt', pkg_lines)
    run_pip('bundle', '-r', 'bundle-req.txt', 'test.pybundle')
    build_bundle = env.scratch_path/"build-bundle"
    src_bundle = env.scratch_path/"src-bundle"
    assert not exists(build_bundle), "build-bundle/ dir still exists: %s" % build_bundle
    assert not exists(src_bundle), "src-bundle/ dir still exists: %s" % src_bundle

    # Make sure previously created src/ from editable still exists
    assert exists(src), "expected src dir doesn't exist: %s" % src
Beispiel #8
0
def test_uninstall_from_reqs_file():
    """
    Test uninstall from a requirements file.

    """
    env = reset_env()
    write_file(
        'test-req.txt',
        textwrap.dedent("""\
        -e %s#egg=initools-dev
        # and something else to test out:
        PyLogo<0.4
        """ % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    result = run_pip('install', '-r', 'test-req.txt')
    write_file(
        'test-req.txt',
        textwrap.dedent("""\
        # -f, -i, and --extra-index-url should all be ignored by uninstall
        -f http://www.example.com
        -i http://www.example.com
        --extra-index-url http://www.example.com

        -e %s#egg=initools-dev
        # and something else to test out:
        PyLogo<0.4
        """ % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    result2 = run_pip('uninstall', '-r', 'test-req.txt', '-y')
    assert_all_changes(
        result, result2,
        [env.venv / 'build', env.venv / 'src', env.scratch / 'test-req.txt'])
Beispiel #9
0
def test_git_with_tag_name_and_update():
    """
    Test cloning a git repository and updating to a different version.
    """
    reset_env()
    result = run_pip('install', '-e', '%s#egg=django-staticfiles' %
                     local_checkout('git+http://github.com/jezdez/django-staticfiles.git'),
                     expect_error=True)
    result.assert_installed('django-staticfiles', with_files=['.git'])
    result = run_pip('install', '--global-option=--version', '-e',
                     '%[email protected]#egg=django-staticfiles' %
                     local_checkout('git+http://github.com/jezdez/django-staticfiles.git'),
                     expect_error=True)
    assert '0.3.1\n' in result.stdout
Beispiel #10
0
def test_create_bundle():
    """
    Test making a bundle.  We'll grab one package from the filesystem
    (the FSPkg dummy package), one from vcs (initools) and one from an
    index (pip itself).

    """
    env = reset_env()
    fspkg = path_to_url2(Path(here) / 'packages' / 'FSPkg')
    run_pip('install', '-e', fspkg)
    pkg_lines = textwrap.dedent(
        '''\
            -e %s
            -e %s#egg=initools-dev
            pip''' %
        (fspkg,
         local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    write_file('bundle-req.txt', pkg_lines)
    # Create a bundle in env.scratch_path/ test.pybundle
    result = run_pip('bundle', '-r', env.scratch_path / 'bundle-req.txt',
                     env.scratch_path / 'test.pybundle')
    bundle = result.files_after.get(join('scratch', 'test.pybundle'), None)
    assert bundle is not None

    files = zipfile.ZipFile(bundle.full).namelist()
    assert 'src/FSPkg/' in files
    assert 'src/initools/' in files
    assert 'build/pip/' in files
Beispiel #11
0
def test_freeze_git_clone():
    """
    Test freezing a Git clone.

    """
    env = reset_env()
    result = env.run(
        'git', 'clone',
        local_repo('git+http://github.com/jezdez/django-pagination.git'),
        'django-pagination')
    result = env.run('git',
                     'checkout',
                     '1df6507872d73ee387eb375428eafbfc253dfcd8',
                     cwd=env.scratch_path / 'django-pagination',
                     expect_stderr=True)
    result = env.run('python',
                     'setup.py',
                     'develop',
                     cwd=env.scratch_path / 'django-pagination')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent(
        """\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %s@...#egg=django_pagination-...
        ...""" %
        local_checkout('git+http://github.com/jezdez/django-pagination.git'))
    _check_output(result, expected)

    result = run_pip(
        'freeze',
        '-f',
        '%s#egg=django_pagination' %
        local_checkout('git+http://github.com/jezdez/django-pagination.git'),
        expect_stderr=True)
    expected = textwrap.dedent(
        """\
        Script result: pip freeze -f %(repo)s#egg=django_pagination
        -- stdout: --------------------
        -f %(repo)s#egg=django_pagination
        -e %(repo)s@...#egg=django_pagination-dev
        ...""" % {
            'repo':
            local_checkout(
                'git+http://github.com/jezdez/django-pagination.git')
        })
    _check_output(result, expected)
Beispiel #12
0
def test_freeze_bazaar_clone():
    """
    Test freezing a Bazaar clone.

    """
    reset_env()
    env = get_env()
    result = env.run(
        'bzr', 'checkout', '-r', '174',
        local_repo(
            'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'
        ), 'django-wikiapp')
    result = env.run('python',
                     'setup.py',
                     'develop',
                     cwd=env.scratch_path / 'django-wikiapp')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %s@...#egg=django_wikiapp-...
        ...""" % local_checkout(
        'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'
    ))
    _check_output(result, expected)

    result = run_pip(
        'freeze',
        '-f',
        '%s/#egg=django-wikiapp' % local_checkout(
            'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'
        ),
        expect_stderr=True)
    expected = textwrap.dedent(
        """\
        Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp
        -- stdout: --------------------
        -f %(repo)s/#egg=django-wikiapp
        -e %(repo)s@...#egg=django_wikiapp-...
        ...""" % {
            'repo':
            local_checkout(
                'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'
            )
        })
    _check_output(result, expected)
Beispiel #13
0
def test_git_with_editable_where_egg_contains_dev_string():
    """
    Test cloning a git repository from an editable url witch contains "dev" string
    """
    reset_env()
    result = run_pip('install', '-e', '%s#egg=django-devserver' %
                     local_checkout('git+git://github.com/dcramer/django-devserver.git'))
    result.assert_installed('django-devserver', with_files=['.git'])
Beispiel #14
0
def test_install_global_option_using_editable():
    """
    Test using global distutils options, but in an editable installation
    """
    reset_env()
    result = run_pip('install', '--global-option=--version',
                     '-e', '%s#egg=virtualenv' %
                      local_checkout('hg+http://bitbucket.org/ianb/[email protected]'))
    assert '1.4.1\n' in result.stdout
Beispiel #15
0
def test_install_global_option_using_editable():
    """
    Test using global distutils options, but in an editable installation
    """
    reset_env()
    result = run_pip(
        'install', '--global-option=--version', '-e', '%s#egg=virtualenv' %
        local_checkout('hg+http://bitbucket.org/ianb/[email protected]'))
    assert '1.4.1\n' in result.stdout
Beispiel #16
0
def test_install_editable_from_svn():
    """
    Test checking out from svn.
    """
    reset_env()
    result = run_pip(
        'install', '-e', '%s#egg=initools-dev' %
        local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
    result.assert_installed('INITools', with_files=['.svn'])
Beispiel #17
0
def test_git_with_editable_where_egg_contains_dev_string():
    """
    Test cloning a git repository from an editable url witch contains "dev" string
    """
    reset_env()
    result = run_pip(
        'install', '-e', '%s#egg=django-devserver' %
        local_checkout('git+git://github.com/dcramer/django-devserver.git'))
    result.assert_installed('django-devserver', with_files=['.git'])
Beispiel #18
0
def test_git_with_non_editable_where_egg_contains_dev_string():
    """
    Test cloning a git repository from a non-editable url witch contains "dev" string
    """
    env = reset_env()
    result = run_pip('install', '%s#egg=django-devserver' %
                     local_checkout('git+git://github.com/dcramer/django-devserver.git'))
    devserver_folder = env.site_packages/'devserver'
    assert devserver_folder in result.files_created, str(result)
Beispiel #19
0
def test_git_with_non_editable_unpacking():
    """
    Test cloning a git repository from a non-editable URL with a given tag.
    """
    reset_env()
    result = run_pip('install', '--global-option=--version', local_checkout(
                     'git+http://github.com/jezdez/[email protected]#egg=django-staticfiles'
                     ), expect_error=True)
    assert '0.3.1\n' in result.stdout
Beispiel #20
0
def test_editable_no_install_followed_by_no_download():
    """
    Test installing an editable in two steps (first with --no-install, then with --no-download).
    """
    reset_env()

    result = run_pip('install',
                     '-e',
                     '%s#egg=initools-dev' %
                     local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
                     '--no-install', expect_error=True)
    result.assert_installed('INITools', without_egg_link=True, with_files=['.svn'])

    result = run_pip('install',
                     '-e',
                     '%s#egg=initools-dev' %
                     local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
                     '--no-download', expect_error=True)
    result.assert_installed('INITools', without_files=[curdir, '.svn'])
Beispiel #21
0
def test_install_editable_from_hg():
    """
    Test cloning from Mercurial.
    """
    reset_env()
    result = run_pip('install', '-e',
                     '%s#egg=django-registration' %
                     local_checkout('hg+http://bitbucket.org/ubernostrum/django-registration'),
                     expect_error=True)
    result.assert_installed('django-registration', with_files=['.hg'])
Beispiel #22
0
def test_install_editable_from_svn():
    """
    Test checking out from svn.
    """
    reset_env()
    result = run_pip('install',
                     '-e',
                     '%s#egg=initools-dev' %
                     local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
    result.assert_installed('INITools', with_files=['.svn'])
Beispiel #23
0
def test_git_with_non_editable_where_egg_contains_dev_string():
    """
    Test cloning a git repository from a non-editable url witch contains "dev" string
    """
    env = reset_env()
    result = run_pip(
        'install', '%s#egg=django-devserver' %
        local_checkout('git+git://github.com/dcramer/django-devserver.git'))
    devserver_folder = env.site_packages / 'devserver'
    assert devserver_folder in result.files_created, str(result)
Beispiel #24
0
def test_vcs_url_final_slash_normalization():
    """
    Test that presence or absence of final slash in VCS URL is normalized.
    """
    reset_env()
    result = run_pip('install', '-e',
                     '%s/#egg=django-registration' %
                     local_checkout('hg+http://bitbucket.org/ubernostrum/django-registration'),
                     expect_error=True)
    assert 'pip-log.txt' not in result.files_created, result.files_created['pip-log.txt'].bytes
Beispiel #25
0
def test_install_editable_from_bazaar():
    """
    Test checking out from Bazaar.
    """
    reset_env()
    result = run_pip('install', '-e',
                     '%s/@174#egg=django-wikiapp' %
                     local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'),
                     expect_error=True)
    result.assert_installed('django-wikiapp', with_files=['.bzr'])
Beispiel #26
0
def test_install_editable_from_git():
    """
    Test cloning from Git.
    """
    reset_env()
    result = run_pip('install', '-e',
                     '%s#egg=django-feedutil' %
                     local_checkout('git+http://github.com/jezdez/django-feedutil.git'),
                     expect_error=True)
    result.assert_installed('django-feedutil', with_files=['.git'])
Beispiel #27
0
def test_vcs_url_urlquote_normalization():
    """
    Test that urlquoted characters are normalized for repo URL comparison.
    """
    reset_env()
    result = run_pip('install', '-e',
                     '%s/#egg=django-wikiapp' %
                     local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'),
                     expect_error=True)
    assert 'pip-log.txt' not in result.files_created, result.files_created['pip-log.txt'].bytes
Beispiel #28
0
def test_freeze_mercurial_clone():
    """
    Test freezing a Mercurial clone.

    """
    reset_env()
    env = get_env()
    result = env.run(
        'hg', 'clone', '-r', 'f8f7eaf275c5',
        local_repo('hg+http://bitbucket.org/jezdez/django-dbtemplates'),
        'django-dbtemplates')
    result = env.run('python',
                     'setup.py',
                     'develop',
                     cwd=env.scratch_path / 'django-dbtemplates')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent(
        """\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %s@...#egg=django_dbtemplates-...
        ...""" %
        local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates'))
    _check_output(result, expected)

    result = run_pip(
        'freeze',
        '-f',
        '%s#egg=django_dbtemplates' %
        local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates'),
        expect_stderr=True)
    expected = textwrap.dedent(
        """\
        Script result: ...pip freeze -f %(repo)s#egg=django_dbtemplates
        -- stdout: --------------------
        -f %(repo)s#egg=django_dbtemplates
        -e %(repo)s@...#egg=django_dbtemplates-dev
        ...""" % {
            'repo':
            local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates')
        })
    _check_output(result, expected)
Beispiel #29
0
def test_git_with_tag_name_and_update():
    """
    Test cloning a git repository and updating to a different version.
    """
    reset_env()
    result = run_pip(
        'install',
        '-e',
        '%s#egg=django-staticfiles' %
        local_checkout('git+http://github.com/jezdez/django-staticfiles.git'),
        expect_error=True)
    result.assert_installed('django-staticfiles', with_files=['.git'])
    result = run_pip(
        'install',
        '--global-option=--version',
        '-e',
        '%[email protected]#egg=django-staticfiles' %
        local_checkout('git+http://github.com/jezdez/django-staticfiles.git'),
        expect_error=True)
    assert '0.3.1\n' in result.stdout
Beispiel #30
0
def test_git_branch_should_not_be_changed():
    """
    Editable installations should not change branch
    related to issue #32 and #161
    """
    env = reset_env()
    run_pip('install', '-e', '%s#egg=django-staticfiles' %
                local_checkout('git+http://github.com/jezdez/django-staticfiles.git'),
                expect_error=True)
    source_dir = env.venv_path/'src'/'django-staticfiles'
    result = env.run('git', 'branch', cwd=source_dir)
    assert '* master' in result.stdout
Beispiel #31
0
def test_install_editable_from_hg():
    """
    Test cloning from Mercurial.
    """
    reset_env()
    result = run_pip(
        'install',
        '-e',
        '%s#egg=django-registration' % local_checkout(
            'hg+http://bitbucket.org/ubernostrum/django-registration'),
        expect_error=True)
    result.assert_installed('django-registration', with_files=['.hg'])
Beispiel #32
0
def test_uninstall_editable_from_svn():
    """
    Test uninstalling an editable installation from svn.

    """
    env = reset_env()
    result = run_pip('install', '-e', '%s#egg=initools-dev' %
                     local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
    result.assert_installed('INITools')
    result2 = run_pip('uninstall', '-y', 'initools')
    assert (env.venv/'src'/'initools' in result2.files_after), 'oh noes, pip deleted my sources!'
    assert_all_changes(result, result2, [env.venv/'src', env.venv/'build'])
Beispiel #33
0
    def test_install_subversion_usersite_editable_with_setuptools_fails():
        """
        Test installing current directory ('.') into usersite using setuptools
        """
        env = reset_env()
        (env.lib_path/'no-global-site-packages.txt').rm() # this one reenables user_site

        result = run_pip('install', '--user', '-e',
                         '%s#egg=initools-dev' %
                         local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
                         expect_error=True)
        assert '--user --editable not supported with setuptools, use distribute' in result.stdout
Beispiel #34
0
def test_install_using_install_option_and_editable():
    """
    Test installing a tool using -e and --install-option
    """
    env = reset_env()
    folder = 'script_folder'
    mkdir(folder)
    result = run_pip('install', '-e', '%s#egg=virtualenv' %
                      local_checkout('hg+http://bitbucket.org/ianb/virtualenv'),
                     '--install-option=--script-dir=%s' % folder)
    virtualenv_bin = env.venv/'src'/'virtualenv'/folder/'virtualenv'+env.exe
    assert virtualenv_bin in result.files_created
Beispiel #35
0
    def test_install_subversion_usersite_editable_with_distribute():
        """
        Test installing current directory ('.') into usersite after installing distribute
        """
        env = reset_env()
        env.run('easy_install', 'distribute')
        (env.lib_path/'no-global-site-packages.txt').rm() # this one reenables user_site

        result = run_pip('install', '--user', '-e',
                         '%s#egg=initools-dev' %
                         local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
        result.assert_installed('INITools', use_user_site=True)
Beispiel #36
0
def test_install_editable_from_git_with_https():
    """
    Test cloning from Git with https.
    """
    env = reset_env()
    result = run_pip(
        'install',
        '-e',
        '%s#egg=django-feedutil' %
        local_checkout('git+https://github.com/jezdez/django-feedutil.git'),
        expect_error=True)
    result.assert_installed('django-feedutil', with_files=['.git'])
Beispiel #37
0
def test_git_with_non_editable_unpacking():
    """
    Test cloning a git repository from a non-editable URL with a given tag.
    """
    reset_env()
    result = run_pip(
        'install',
        '--global-option=--version',
        local_checkout(
            'git+http://github.com/jezdez/[email protected]#egg=django-staticfiles'
        ),
        expect_error=True)
    assert '0.3.1\n' in result.stdout
Beispiel #38
0
    def test_install_subversion_usersite_editable_with_distribute():
        """
        Test installing current directory ('.') into usersite after installing distribute
        """
        env = reset_env()
        env.run('easy_install', 'distribute')
        (env.lib_path /
         'no-global-site-packages.txt').rm()  # this one reenables user_site

        result = run_pip(
            'install', '--user', '-e', '%s#egg=initools-dev' %
            local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
        result.assert_installed('INITools', use_user_site=True)
Beispiel #39
0
def test_vcs_url_final_slash_normalization():
    """
    Test that presence or absence of final slash in VCS URL is normalized.
    """
    reset_env()
    result = run_pip(
        'install',
        '-e',
        '%s/#egg=django-registration' % local_checkout(
            'hg+http://bitbucket.org/ubernostrum/django-registration'),
        expect_error=True)
    assert 'pip-log.txt' not in result.files_created, result.files_created[
        'pip-log.txt'].bytes
Beispiel #40
0
def test_install_using_install_option_and_editable():
    """
    Test installing a tool using -e and --install-option
    """
    env = reset_env()
    folder = 'script_folder'
    mkdir(folder)
    result = run_pip(
        'install', '-e', '%s#egg=virtualenv' %
        local_checkout('hg+http://bitbucket.org/ianb/virtualenv'),
        '--install-option=--script-dir=%s' % folder)
    virtualenv_bin = env.venv / 'src' / 'virtualenv' / folder / 'virtualenv' + env.exe
    assert virtualenv_bin in result.files_created
Beispiel #41
0
def test_install_editable_from_bazaar():
    """
    Test checking out from Bazaar.
    """
    reset_env()
    result = run_pip(
        'install',
        '-e',
        '%s/@174#egg=django-wikiapp' % local_checkout(
            'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'
        ),
        expect_error=True)
    result.assert_installed('django-wikiapp', with_files=['.bzr'])
Beispiel #42
0
def test_vcs_url_urlquote_normalization():
    """
    Test that urlquoted characters are normalized for repo URL comparison.
    """
    reset_env()
    result = run_pip(
        'install',
        '-e',
        '%s/#egg=django-wikiapp' % local_checkout(
            'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'
        ),
        expect_error=True)
    assert 'pip-log.txt' not in result.files_created, result.files_created[
        'pip-log.txt'].bytes
Beispiel #43
0
def test_uninstall_editable_from_svn():
    """
    Test uninstalling an editable installation from svn.

    """
    env = reset_env()
    result = run_pip(
        'install', '-e', '%s#egg=initools-dev' %
        local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
    result.assert_installed('INITools')
    result2 = run_pip('uninstall', '-y', 'initools')
    assert (env.venv / 'src' / 'initools'
            in result2.files_after), 'oh noes, pip deleted my sources!'
    assert_all_changes(result, result2, [env.venv / 'src', env.venv / 'build'])
Beispiel #44
0
def test_cleanup_after_install_editable_from_hg():
    """
    Test clean up after cloning from Mercurial.

    """
    env = reset_env()
    run_pip('install',
            '-e',
            '%s#egg=django-registration' %
            local_checkout('hg+http://bitbucket.org/ubernostrum/django-registration'),
            expect_error=True)
    build = env.venv_path/'build'
    src = env.venv_path/'src'
    assert not exists(build), "build/ dir still exists: %s" % build
    assert exists(src), "expected src/ dir doesn't exist: %s" % src
Beispiel #45
0
def test_git_branch_should_not_be_changed():
    """
    Editable installations should not change branch
    related to issue #32 and #161
    """
    env = reset_env()
    run_pip(
        'install',
        '-e',
        '%s#egg=django-staticfiles' %
        local_checkout('git+http://github.com/jezdez/django-staticfiles.git'),
        expect_error=True)
    source_dir = env.venv_path / 'src' / 'django-staticfiles'
    result = env.run('git', 'branch', cwd=source_dir)
    assert '* master' in result.stdout
Beispiel #46
0
def test_cleanup_after_install_editable_from_hg():
    """
    Test clean up after cloning from Mercurial.

    """
    env = reset_env()
    run_pip('install',
            '-e',
            '%s#egg=django-registration' % local_checkout(
                'hg+http://bitbucket.org/ubernostrum/django-registration'),
            expect_error=True)
    build = env.venv_path / 'build'
    src = env.venv_path / 'src'
    assert not exists(build), "build/ dir still exists: %s" % build
    assert exists(src), "expected src/ dir doesn't exist: %s" % src
Beispiel #47
0
def test_multiple_requirements_files():
    """
    Test installing from multiple nested requirements files.

    """
    env = reset_env()
    write_file('initools-req.txt', textwrap.dedent("""\
        -e %s@10#egg=INITools-dev
        -r simplejson-req.txt""" % local_checkout('http://svn.colorstudy.com/INITools/trunk')))
    write_file('simplejson-req.txt', textwrap.dedent("""\
        simplejson<=1.7.4
        """))
    result = run_pip('install', '-r', env.scratch_path / 'initools-req.txt')
    assert result.files_created[env.site_packages/'simplejson'].dir
    assert result.files_created[env.site_packages/'simplejson-1.7.4-py%s.egg-info' % pyversion].dir
    assert env.venv/'src'/'initools' in result.files_created
Beispiel #48
0
    def test_install_subversion_usersite_editable_with_setuptools_fails():
        """
        Test installing current directory ('.') into usersite using setuptools
        """
        env = reset_env()
        (env.lib_path /
         'no-global-site-packages.txt').rm()  # this one reenables user_site

        result = run_pip(
            'install',
            '--user',
            '-e',
            '%s#egg=initools-dev' %
            local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
            expect_error=True)
        assert '--user --editable not supported with setuptools, use distribute' in result.stdout
Beispiel #49
0
def test_download_editable_to_custom_path():
    """
    Test downloading an editable using a relative custom src folder.
    """
    reset_env()
    mkdir('customdl')
    result = run_pip('install',
                     '-e',
                     '%s#egg=initools-dev' %
                     local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
                     '--src',
                     'customsrc',
                     '--download',
                     'customdl')
    customsrc = Path('scratch')/'customsrc'/'initools'
    assert customsrc in result.files_created, sorted(result.files_created.keys())
    assert customsrc/'setup.py' in result.files_created, sorted(result.files_created.keys())

    customdl = Path('scratch')/'customdl'/'initools'
    customdl_files_created = [filename for filename in result.files_created
                                           if filename.startswith(customdl)]
    assert customdl_files_created
Beispiel #50
0
def test_download_editable_to_custom_path():
    """
    Test downloading an editable using a relative custom src folder.
    """
    reset_env()
    mkdir('customdl')
    result = run_pip(
        'install', '-e', '%s#egg=initools-dev' %
        local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
        '--src', 'customsrc', '--download', 'customdl')
    customsrc = Path('scratch') / 'customsrc' / 'initools'
    assert customsrc in result.files_created, sorted(
        result.files_created.keys())
    assert customsrc / 'setup.py' in result.files_created, sorted(
        result.files_created.keys())

    customdl = Path('scratch') / 'customdl' / 'initools'
    customdl_files_created = [
        filename for filename in result.files_created
        if filename.startswith(customdl)
    ]
    assert customdl_files_created
Beispiel #51
0
def test_multiple_requirements_files():
    """
    Test installing from multiple nested requirements files.

    """
    env = reset_env()
    write_file(
        'initools-req.txt',
        textwrap.dedent(
            """\
        -e %s@10#egg=INITools-dev
        -r simplejson-req.txt""" %
            local_checkout('http://svn.colorstudy.com/INITools/trunk')))
    write_file('simplejson-req.txt',
               textwrap.dedent("""\
        simplejson<=1.7.4
        """))
    result = run_pip('install', '-r', env.scratch_path / 'initools-req.txt')
    assert result.files_created[env.site_packages / 'simplejson'].dir
    assert result.files_created[env.site_packages /
                                'simplejson-1.7.4-py%s.egg-info' %
                                pyversion].dir
    assert env.venv / 'src' / 'initools' in result.files_created
Beispiel #52
0
def test_create_bundle():
    """
    Test making a bundle.  We'll grab one package from the filesystem
    (the FSPkg dummy package), one from vcs (initools) and one from an
    index (pip itself).

    """
    env = reset_env()
    fspkg = path_to_url2(Path(here)/'packages'/'FSPkg')
    run_pip('install', '-e', fspkg)
    pkg_lines = textwrap.dedent('''\
            -e %s
            -e %s#egg=initools-dev
            pip''' % (fspkg, local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')))
    write_file('bundle-req.txt', pkg_lines)
    # Create a bundle in env.scratch_path/ test.pybundle
    result = run_pip('bundle', '-r', env.scratch_path/ 'bundle-req.txt', env.scratch_path/ 'test.pybundle')
    bundle = result.files_after.get(join('scratch', 'test.pybundle'), None)
    assert bundle is not None

    files = zipfile.ZipFile(bundle.full).namelist()
    assert 'src/FSPkg/' in files
    assert 'src/initools/' in files
    assert 'build/pip/' in files
Beispiel #53
0
def test_freeze():
    """
    Some tests of freeze, first we have to install some stuff.  Note that
    the test is a little crude at the end because Python 2.5+ adds egg
    info to the standard library, so stuff like wsgiref will show up in
    the freezing.  (Probably that should be accounted for in pip, but
    currently it is not).

    TODO: refactor this test into multiple tests? (and maybe different
    test style instead of using doctest output checker)

    """
    env = reset_env()
    write_file('initools-req.txt', textwrap.dedent("""\
        INITools==0.2
        # and something else to test out:
        simplejson<=1.7.4
        """))
    result = run_pip('install', '-r', env.scratch_path/'initools-req.txt')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: pip freeze
        -- stdout: --------------------
        INITools==0.2
        simplejson==1.7.4...
        <BLANKLINE>""")
    _check_output(result, expected)

    # Now lets try it with an svn checkout::
    result = env.run('svn', 'co', '-r10',
                     local_repo('svn+http://svn.colorstudy.com/INITools/trunk'),
                     'initools-trunk')
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path/ 'initools-trunk')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %s@10#egg=INITools-0.3.1dev_r10-py2...-dev_r10
        simplejson==1.7.4...
        <BLANKLINE>""" % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
    _check_output(result, expected)

    # Now, straight from trunk (but not editable/setup.py develop)::
    result = env.run('svn', 'co',
                     local_repo('svn+http://svn.colorstudy.com/INITools/trunk'),
                     'initools_to_easy_install')
    result = env.run('easy_install', env.scratch_path/'initools_to_easy_install')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stderr: --------------------
        Warning: cannot find svn location for INITools==...dev-r...
        <BLANKLINE>
        -- stdout: --------------------
        ## FIXME: could not find svn URL in dependency_links for this package:
        INITools==...dev-r...
        simplejson==1.7.4...
        <BLANKLINE>""")
    _check_output(result, expected)

    # Bah, that's no good!  Let's give it a hint::
    result = run_pip('freeze', '-f',
                     '%s#egg=INITools-dev' %
                     local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s#egg=INITools-dev
        -- stdout: --------------------
        -f %(repo)s#egg=INITools-dev
        # Installing as editable to satisfy requirement INITools==...dev-r...:
        -e %(repo)s@...#egg=INITools-...dev_r...
        simplejson==1.7.4...
        <BLANKLINE>""" % {'repo': local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')})
    _check_output(result, expected)
Beispiel #54
0
def test_freeze():
    """
    Some tests of freeze, first we have to install some stuff.  Note that
    the test is a little crude at the end because Python 2.5+ adds egg
    info to the standard library, so stuff like wsgiref will show up in
    the freezing.  (Probably that should be accounted for in pip, but
    currently it is not).

    TODO: refactor this test into multiple tests? (and maybe different
    test style instead of using doctest output checker)

    """
    env = reset_env()
    write_file(
        'initools-req.txt',
        textwrap.dedent("""\
        INITools==0.2
        # and something else to test out:
        simplejson<=1.7.4
        """))
    result = run_pip('install', '-r', env.scratch_path / 'initools-req.txt')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: pip freeze
        -- stdout: --------------------
        INITools==0.2
        simplejson==1.7.4...
        <BLANKLINE>""")
    _check_output(result, expected)

    # Now lets try it with an svn checkout::
    result = env.run(
        'svn', 'co', '-r10',
        local_repo('svn+http://svn.colorstudy.com/INITools/trunk'),
        'initools-trunk')
    result = env.run('python',
                     'setup.py',
                     'develop',
                     cwd=env.scratch_path / 'initools-trunk')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent(
        """\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %s@10#egg=INITools-0.3.1dev_r10-py2...-dev_r10
        simplejson==1.7.4...
        <BLANKLINE>""" %
        local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))
    _check_output(result, expected)

    # Now, straight from trunk (but not editable/setup.py develop)::
    result = env.run(
        'svn', 'co',
        local_repo('svn+http://svn.colorstudy.com/INITools/trunk'),
        'initools_to_easy_install')
    result = env.run('easy_install',
                     env.scratch_path / 'initools_to_easy_install')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stderr: --------------------
        Warning: cannot find svn location for INITools==...dev-r...
        <BLANKLINE>
        -- stdout: --------------------
        ## FIXME: could not find svn URL in dependency_links for this package:
        INITools==...dev-r...
        simplejson==1.7.4...
        <BLANKLINE>""")
    _check_output(result, expected)

    # Bah, that's no good!  Let's give it a hint::
    result = run_pip(
        'freeze',
        '-f',
        '%s#egg=INITools-dev' %
        local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'),
        expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s#egg=INITools-dev
        -- stdout: --------------------
        -f %(repo)s#egg=INITools-dev
        # Installing as editable to satisfy requirement INITools==...dev-r...:
        -e %(repo)s@...#egg=INITools-...dev_r...
        simplejson==1.7.4...
        <BLANKLINE>""" % {
        'repo':
        local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')
    })
    _check_output(result, expected)