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


Python test_pip.mkdir函数代码示例

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


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

示例1: test_install_package_with_same_name_in_curdir

def test_install_package_with_same_name_in_curdir():
    """
    Test installing a package with the same name of a local folder
    """
    env = reset_env()
    mkdir('mock==0.6')
    result = run_pip('install', 'mock==0.6')
    egg_folder = env.site_packages / 'mock-0.6.0-py%s.egg-info' % pyversion
    assert egg_folder in result.files_created, str(result)
开发者ID:saxix,项目名称:pip,代码行数:9,代码来源:test_basic.py

示例2: test_no_install_and_download_should_not_leave_build_dir

def test_no_install_and_download_should_not_leave_build_dir():
    """
    It should remove build/ dir if it was pip that created
    """
    env = reset_env()
    mkdir('downloaded_packages')
    assert not os.path.exists(env.venv_path/'/build')
    result = run_pip('install', '--no-install', 'INITools==0.2', '-d', 'downloaded_packages')
    assert Path('scratch')/'downloaded_packages/build' not in result.files_created, 'pip should not leave build/ dir'
    assert not os.path.exists(env.venv_path/'/build'), "build/ dir should be deleted"
开发者ID:michaeta,项目名称:pip,代码行数:10,代码来源:test_cleanup.py

示例3: _create_test_package_submodule

def _create_test_package_submodule(env):
    mkdir('version_pkg_submodule')
    submodule_path = env.scratch_path/'version_pkg_submodule'
    env.run('touch', 'testfile', cwd=submodule_path)
    env.run('git', 'init', cwd=submodule_path)
    env.run('git', 'add', '.', cwd=submodule_path)
    env.run('git', 'commit', '-q',
            '--author', 'Pip <[email protected]>',
            '-am', 'initial version / submodule', cwd=submodule_path)
    return submodule_path
开发者ID:AndreaCrotti,项目名称:pip,代码行数:10,代码来源:git_submodule_helpers.py

示例4: test_install_folder_using_slash_in_the_end

def test_install_folder_using_slash_in_the_end():
    r"""
    Test installing a folder using pip install foldername/ or foldername\
    """
    env = reset_env()
    mkdir('mock')
    pkg_path = env.scratch_path/'mock'
    write_file('setup.py', mock100_setup_py, pkg_path)
    result = run_pip('install', 'mock' + os.path.sep)
    egg_folder = env.site_packages / 'mock-100.1-py%s.egg-info' % pyversion
    assert egg_folder in result.files_created, str(result)
开发者ID:saxix,项目名称:pip,代码行数:11,代码来源:test_basic.py

示例5: test_install_folder_using_dot_slash

def test_install_folder_using_dot_slash():
    """
    Test installing a folder using pip install ./foldername
    """
    env = reset_env()
    mkdir("mock")
    pkg_path = env.scratch_path / "mock"
    write_file("setup.py", mock100_setup_py, pkg_path)
    result = run_pip("install", "./mock")
    egg_folder = env.site_packages / "mock-100.1-py%s.egg-info" % pyversion
    assert egg_folder in result.files_created, str(result)
开发者ID:B-Rich,项目名称:heroku-buildpack-python,代码行数:11,代码来源:test_basic.py

示例6: test_install_folder_using_relative_path

def test_install_folder_using_relative_path():
    """
    Test installing a folder using pip install folder1/folder2
    """
    env = reset_env()
    mkdir('initools')
    mkdir(Path('initools')/'mock')
    pkg_path = env.scratch_path/'initools'/'mock'
    write_file('setup.py', mock100_setup_py, pkg_path)
    result = run_pip('install', Path('initools')/'mock')
    egg_folder = env.site_packages / 'mock-100.1-py%s.egg-info' % pyversion
    assert egg_folder in result.files_created, str(result)
开发者ID:saxix,项目名称:pip,代码行数:12,代码来源:test_basic.py

示例7: test_install_folder_using_relative_path

def test_install_folder_using_relative_path():
    """
    Test installing a folder using pip install folder1/folder2
    """
    env = reset_env()
    mkdir("initools")
    mkdir(Path("initools") / "mock")
    pkg_path = env.scratch_path / "initools" / "mock"
    write_file("setup.py", mock100_setup_py, pkg_path)
    result = run_pip("install", Path("initools") / "mock")
    egg_folder = env.site_packages / "mock-100.1-py%s.egg-info" % pyversion
    assert egg_folder in result.files_created, str(result)
开发者ID:B-Rich,项目名称:heroku-buildpack-python,代码行数:12,代码来源:test_basic.py

示例8: test_install_using_install_option_and_editable

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)
    url = 'git+git://github.com/pypa/virtualenv'
    result = run_pip('install', '-e', '%s#egg=virtualenv' %
                      local_checkout(url),
                     '--install-option=--script-dir=%s' % folder)
    virtualenv_bin = env.venv/'src'/'virtualenv'/folder/'virtualenv'+env.exe
    assert virtualenv_bin in result.files_created
开发者ID:saxix,项目名称:pip,代码行数:13,代码来源:test_basic.py

示例9: test_install_using_install_option_and_editable

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)
    url = "git+git://github.com/pypa/virtualenv"
    result = run_pip(
        "install", "-e", "%s#egg=virtualenv" % local_checkout(url), "--install-option=--script-dir=%s" % folder
    )
    virtualenv_bin = env.venv / "src" / "virtualenv" / folder / "virtualenv" + env.exe
    assert virtualenv_bin in result.files_created
开发者ID:B-Rich,项目名称:heroku-buildpack-python,代码行数:13,代码来源:test_basic.py

示例10: test_download_should_not_delete_existing_build_dir

def test_download_should_not_delete_existing_build_dir():
    """
    It should not delete build/ if existing before run the command
    """
    env = reset_env()
    mkdir(env.venv_path/'build')
    f = open(env.venv_path/'build'/'somefile.txt', 'w')
    f.write('I am not empty!')
    f.close()
    run_pip('install', '--no-install', 'INITools==0.2', '-d', '.')
    f = open(env.venv_path/'build'/'somefile.txt')
    content = f.read()
    f.close()
    assert os.path.exists(env.venv_path/'build'), "build/ should be left if it exists before pip run"
    assert content == 'I am not empty!', "it should not affect build/ and its content"
    assert ['somefile.txt'] == os.listdir(env.venv_path/'build')
开发者ID:michaeta,项目名称:pip,代码行数:16,代码来源:test_cleanup.py

示例11: test_download_editable_to_custom_path

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

示例12: test_download_editable_to_custom_path

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
开发者ID:B-Rich,项目名称:heroku-buildpack-python,代码行数:22,代码来源:test_basic.py

示例13: _create_test_package_with_submodule

def _create_test_package_with_submodule(env):
    mkdir('version_pkg')
    version_pkg_path = env.scratch_path/'version_pkg'
    mkdir(version_pkg_path/'testpkg')
    pkg_path = version_pkg_path/'testpkg'

    write_file('__init__.py', '# hello there', pkg_path)
    write_file('version_pkg.py', textwrap.dedent('''\
                                def main():
                                    print('0.1')
                                '''), pkg_path)
    write_file('setup.py', textwrap.dedent('''\
                        from setuptools import setup, find_packages
                        setup(name='version_pkg',
                              version='0.1',
                              packages=find_packages(),
                             )
                        '''), version_pkg_path)
    env.run('git', 'init', cwd=version_pkg_path, expect_error=True)
    env.run('git', 'add', '.', cwd=version_pkg_path, expect_error=True)
    env.run('git', 'commit', '-q',
            '--author', 'Pip <[email protected]>',
            '-am', 'initial version', cwd=version_pkg_path,
            expect_error=True)


    submodule_path = _create_test_package_submodule(env)

    env.run('git', 'submodule', 'add', submodule_path, 'testpkg/static', cwd=version_pkg_path,
            expect_error=True)
    env.run('git', 'commit', '-q',
            '--author', 'Pip <[email protected]>',
            '-am', 'initial version w submodule', cwd=version_pkg_path,
            expect_error=True)


    return version_pkg_path, submodule_path
开发者ID:AndreaCrotti,项目名称:pip,代码行数:37,代码来源:git_submodule_helpers.py

示例14: test_find_command_folder_in_path

def test_find_command_folder_in_path():
    """
    If a folder named e.g. 'git' is in PATH, and find_command is looking for
    the 'git' executable, it should not match the folder, but rather keep
    looking.
    """
    env = reset_env()
    mkdir('path_one'); path_one = env.scratch_path/'path_one'
    mkdir(path_one/'foo')
    mkdir('path_two'); path_two = env.scratch_path/'path_two'
    write_file(path_two/'foo', '# nothing')
    found_path = find_command('foo', map(str, [path_one, path_two]))
    assert found_path == path_two/'foo'
开发者ID:PJMODOS,项目名称:pip,代码行数:13,代码来源:test_basic.py

示例15: test_find_command_folder_in_path

def test_find_command_folder_in_path():
    """
    If a folder named e.g. 'git' is in PATH, and find_command is looking for
    the 'git' executable, it should not match the folder, but rather keep
    looking.
    """
    env = reset_env()
    mkdir("path_one")
    path_one = env.scratch_path / "path_one"
    mkdir(path_one / "foo")
    mkdir("path_two")
    path_two = env.scratch_path / "path_two"
    write_file(path_two / "foo", "# nothing")
    found_path = find_command("foo", map(str, [path_one, path_two]))
    assert found_path == path_two / "foo"
开发者ID:B-Rich,项目名称:heroku-buildpack-python,代码行数:15,代码来源:test_basic.py


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