当前位置: 首页>>代码示例>>Python>>正文


Python local_repos.local_checkout函数代码示例

本文整理汇总了Python中tests.local_repos.local_checkout函数的典型用法代码示例。如果您正苦于以下问题:Python local_checkout函数的具体用法?Python local_checkout怎么用?Python local_checkout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了local_checkout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_freeze_git_clone

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 %[email protected]#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)[email protected]#egg=django_pagination-dev
        ...""" % {'repo': local_checkout('git+http://github.com/jezdez/django-pagination.git')})
    _check_output(result, expected)
开发者ID:PJMODOS,项目名称:pip,代码行数:29,代码来源:test_freeze.py

示例2: test_freeze_git_clone

def test_freeze_git_clone():
    """
    Test freezing a Git clone.

    """
    env = reset_env()
    result = env.run('git', 'clone', local_repo('git+http://github.com/pypa/pip-test-package.git'), 'pip-test-package')
    result = env.run('git', 'checkout', '7d654e66c8fa7149c165ddeffa5b56bc06619458',
            cwd=env.scratch_path / 'pip-test-package', expect_stderr=True)
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path / 'pip-test-package')
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        ...-e %[email protected]#egg=pip_test_package-...
        ...""" % local_checkout('git+http://github.com/pypa/pip-test-package.git'))
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s#egg=pip_test_package' % local_checkout('git+http://github.com/pypa/pip-test-package.git'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: pip freeze -f %(repo)s#egg=pip_test_package
        -- stdout: --------------------
        -f %(repo)s#egg=pip_test_package...
        -e %(repo)[email protected]#egg=pip_test_package-dev
        ...""" % {'repo': local_checkout('git+http://github.com/pypa/pip-test-package.git')})
    _check_output(result, expected)
开发者ID:OldBao,项目名称:pip,代码行数:29,代码来源:test_freeze.py

示例3: test_freeze_mercurial_clone

def test_freeze_mercurial_clone():
    """
    Test freezing a Mercurial clone.

    """
    reset_env()
    env = get_env()
    result = env.run('hg', 'clone',
                     '-r', '7bc186caa7dc',
                     local_repo('hg+http://bitbucket.org/jezdez/django-authority'),
                     'django-authority')
    result = env.run('python', 'setup.py', 'develop',
            cwd=env.scratch_path/'django-authority', expect_stderr=True)
    result = run_pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze
        -- stdout: --------------------
        -e %[email protected]#egg=django_authority-...
        ...""" % local_checkout('hg+http://bitbucket.org/jezdez/django-authority'))
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s#egg=django_authority' % local_checkout('hg+http://bitbucket.org/jezdez/django-authority'),
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s#egg=django_authority
        -- stdout: --------------------
        -f %(repo)s#egg=django_authority
        -e %(repo)[email protected]#egg=django_authority-dev
        ...""" % {'repo': local_checkout('hg+http://bitbucket.org/jezdez/django-authority')})
    _check_output(result, expected)
开发者ID:PJMODOS,项目名称:pip,代码行数:31,代码来源:test_freeze.py

示例4: test_cleanup_after_create_bundle

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.
    args = ['install']
    args.extend(['-e',
                 '%s#egg=pip-test-package' %
                    local_checkout('git+http://github.com/pypa/pip-test-package.git')])
    run_pip(*args)
    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
开发者ID:michaeta,项目名称:pip,代码行数:32,代码来源:test_cleanup.py

示例5: test_freeze_bazaar_clone

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 %[email protected]#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)[email protected]#egg=django_wikiapp-...
        ...""" % {'repo':
                  local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1')})
    _check_output(result, expected)
开发者ID:PJMODOS,项目名称:pip,代码行数:32,代码来源:test_freeze.py

示例6: test_uninstall_from_reqs_file

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'])
开发者ID:AndreaCrotti,项目名称:pip,代码行数:25,代码来源:test_uninstall.py

示例7: test_git_with_tag_name_and_update

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
开发者ID:MatthewMaker,项目名称:pip,代码行数:14,代码来源:test_vcs_backends.py

示例8: test_upgrade_editable_if_no_prefer_pinned

def test_upgrade_editable_if_no_prefer_pinned():
    """
    Upgrade editable if 1)--prefer-pinned-revision is False (default) and 2) previously installed version is pinned and not the latest version.

    """
    reset_env()

    local_url = local_checkout('git+http://github.com/prezi/sb-test-package.git')

    args = ['install',
        # older version
        '-e', '%[email protected]#egg=sb-test-package' % local_url]

    result = run_pip(*args, **{"expect_error": True})
    result.assert_installed('sb-test-package')

    args = ['install',
        # unpinned newer version
        '-e', '%s#egg=sb-test-package' % local_url]
    result = run_pip(*args, **{"expect_error": True})

    # worrysome_files_created are all files that aren't located in .git/, created by the comparison `git fetch`
    expected_files_regex = re.compile('[.]git')
    new_files_created = [file_path for file_path in result.files_created.keys() if not expected_files_regex.search(file_path)]

    # new_files_created should contain a file that appears in versions >=0.2.1, but not in 0.2.2
    assert new_files_created, 'sb install sb-test-package did not upgrade when it should have'
开发者ID:ecolitan,项目名称:snakebasket,代码行数:27,代码来源:test_sb_upgrade.py

示例9: test_no_upgrade_editable_if_prefer_pinned

def test_no_upgrade_editable_if_prefer_pinned():
    """
    No upgrade of editable if 1)--prefer-pinned-revision is True and 2) previously installed version is pinned.

    """
    reset_env()

    local_url = local_checkout('git+http://github.com/prezi/sb-test-package.git')

    args = ['install',
        # older version
        '-e', '%[email protected]#egg=sb-test-package' % local_url]

    result = run_pip(*args, **{"expect_error": True})
    result.assert_installed('sb-test-package')

    args = ['install',
        '--prefer-pinned-revision',
        # unpinned newer version
        '-e', '%s#egg=sb-test-package' % local_url]
    result = run_pip(*args, **{"expect_error": True})

    # worrysome_files_created are all files that aren't located in .git/, created by the comparison `git fetch`
    expected_files_regex = re.compile('[.]git')
    worrysome_files_created = [file_path for file_path in result.files_created.keys() if not expected_files_regex.search(file_path)]

    assert not worrysome_files_created, 'sb install sb-test-package upgraded when it should not have'
开发者ID:ecolitan,项目名称:snakebasket,代码行数:27,代码来源:test_sb_upgrade.py

示例10: test_no_upgrade_editable_if_uncommitted_new_file

def test_no_upgrade_editable_if_uncommitted_new_file():
    """
    No upgrade of editable if there are uncommitted local changes.

    """
    env = reset_env()

    local_url = local_checkout('git+http://github.com/prezi/sb-test-package.git')

    args = ['install',
        # older version
        '-e', '%[email protected]#egg=sb-test-package' % local_url]

    result = run_pip(*args, **{"expect_error": True})
    result.assert_installed('sb-test-package')

    # Create a new file that isn't in source control
    subprocess.Popen(['touch', 'new_file.txt'], cwd=os.path.join(env.venv_path, 'src/sb-test-package'), stdout=subprocess.PIPE)

    # Attempt to install a new version
    args = ['install',
        # unpinned newer version
        '-e', '%s#egg=sb-test-package' % local_url]
    result = run_pip(*args, **{"expect_error": True})
    assert versions.__InstallationErrorMessage__ in result.stdout
开发者ID:ecolitan,项目名称:snakebasket,代码行数:25,代码来源:test_sb_upgrade.py

示例11: test_freeze_bazaar_clone

def test_freeze_bazaar_clone():
    """
    Test freezing a Bazaar clone.

    """

    checkout_path = local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1')
    #bzr internally stores windows drives as uppercase; we'll match that.
    checkout_pathC = checkout_path.replace('c:', 'C:')

    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 %[email protected]#egg=django_wikiapp-...
        ...""" % checkout_pathC)
    _check_output(result, expected)

    result = run_pip('freeze', '-f',
                     '%s/#egg=django-wikiapp' % checkout_path,
                     expect_stderr=True)
    expected = textwrap.dedent("""\
        Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp
        -- stdout: --------------------
        -f %(repo)s/#egg=django-wikiapp
        ...-e %(repoC)[email protected]#egg=django_wikiapp-...
        ...""" % {'repoC': checkout_pathC, 'repo': checkout_path})
    _check_output(result, expected)
开发者ID:AndreaCrotti,项目名称:pip,代码行数:35,代码来源:test_freeze.py

示例12: test_no_upgrade_editable_if_uncommitted_change

def test_no_upgrade_editable_if_uncommitted_change():
    """
    No upgrade of editable if there are uncommitted local changes.

    """
    env = reset_env()

    local_url = local_checkout('git+http://github.com/prezi/sb-test-package.git')

    args = ['install',
        # older version
        '-e', '%[email protected]#egg=sb-test-package' % local_url]

    result = run_pip(*args, **{"expect_error": True})
    result.assert_installed('sb-test-package')

    # Make modification to an existing file
    with open(os.path.join(env.venv_path, 'src/sb-test-package', 'requirements.txt'), 'a') as file:
        file.write('local modification!') 

    # Attempt to install a new version
    args = ['install',
        # unpinned newer version
        '-e', '%s#egg=sb-test-package' % local_url]
    result = run_pip(*args, **{"expect_error": True})
    assert versions.__InstallationErrorMessage__ in result.stdout
开发者ID:ecolitan,项目名称:snakebasket,代码行数:26,代码来源:test_sb_upgrade.py

示例13: test_upgrade_editable_if_ignore_untracked_files

def test_upgrade_editable_if_ignore_untracked_files():
    """
    Upgrade editable if --ignore-untracked-files is True

    """
    env = reset_env()

    local_url = local_checkout('git+http://github.com/prezi/sb-test-package.git')

    args = ['install',
        # older version
        '-e', '%[email protected]#egg=sb-test-package' % local_url]

    result = run_pip(*args, **{"expect_error": True})
    result.assert_installed('sb-test-package')

    # Create a new file that isn't in source control
    subprocess.Popen(['touch', 'new_file.txt'], cwd=os.path.join(env.venv_path, 'src/sb-test-package'), stdout=subprocess.PIPE)

    # Attempt to install a new version
    args = ['install',
        '--ignore-untracked-files',
        # unpinned newer version
        '-e', '%s#egg=sb-test-package' % local_url]
    result = run_pip(*args, **{"expect_error": True})

    # worrysome_files_created are all files that aren't located in .git/, created by the comparison `git fetch`
    expected_files_regex = re.compile('[.]git')
    new_files_created = [file_path for file_path in result.files_created.keys() if not expected_files_regex.search(file_path)]

    # new_files_created should contain a file that appears in versions >=0.2.1, but not in 0.2.2
    assert new_files_created, 'sb install sb-test-package did not upgrade when it should have'
开发者ID:stanhu,项目名称:snakebasket,代码行数:32,代码来源:test_sb_upgrade.py

示例14: test_upgrade_vcs_req_with_no_dists_found

def test_upgrade_vcs_req_with_no_dists_found():
    """It can upgrade a VCS requirement that has no distributions otherwise."""
    reset_env()
    req = "%s#egg=pip-test-package" % local_checkout(
        "git+http://github.com/pypa/pip-test-package.git")
    run_pip("install", req)
    result = run_pip("install", "-U", req)
    assert not result.returncode
开发者ID:AndreaCrotti,项目名称:pip,代码行数:8,代码来源:test_upgrade.py

示例15: test_git_with_editable_where_egg_contains_dev_string

def test_git_with_editable_where_egg_contains_dev_string():
    """
    Test cloning a git repository from an editable url which 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'])
开发者ID:MatthewMaker,项目名称:pip,代码行数:8,代码来源:test_vcs_backends.py


注:本文中的tests.local_repos.local_checkout函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。