Exemplo n.º 1
0
def _create_test_package_with_submodule(env):
    env.scratch_path.join("version_pkg").mkdir()
    version_pkg_path = env.scratch_path / 'version_pkg'
    version_pkg_path.join("testpkg").mkdir()
    pkg_path = version_pkg_path / 'testpkg'

    pkg_path.join("__init__.py").write("# hello there")
    _create_main_file(pkg_path, name="version_pkg", output="0.1")
    version_pkg_path.join("setup.py").write(
        textwrap.dedent('''\
                        from setuptools import setup, find_packages
                        setup(name='version_pkg',
                              version='0.1',
                              packages=find_packages(),
                             )
                        '''))
    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 <*****@*****.**>',
            '-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 <*****@*****.**>',
            '-am',
            'initial version w submodule',
            cwd=version_pkg_path,
            expect_error=True)

    return version_pkg_path, submodule_path
Exemplo n.º 2
0
def _create_test_package_with_submodule(env):
    env.scratch_path.join("version_pkg").mkdir()
    version_pkg_path = env.scratch_path / 'version_pkg'
    version_pkg_path.join("testpkg").mkdir()
    pkg_path = version_pkg_path / 'testpkg'

    pkg_path.join("__init__.py").write("# hello there")
    _create_main_file(pkg_path, name="version_pkg", output="0.1")
    version_pkg_path.join("setup.py").write(textwrap.dedent('''\
                        from setuptools import setup, find_packages
                        setup(name='version_pkg',
                              version='0.1',
                              packages=find_packages(),
                             )
                        '''))
    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 <*****@*****.**>',
            '-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 <*****@*****.**>',
            '-am', 'initial version w submodule', cwd=version_pkg_path,
            expect_error=True)

    return version_pkg_path, submodule_path
Exemplo n.º 3
0
def _create_test_package_with_submodule(env: PipTestEnvironment,
                                        rel_path: str) -> Tuple[Path, Path]:
    """
    Args:
      rel_path: the location of the submodule relative to the superproject.
    """
    env.scratch_path.joinpath("version_pkg").mkdir()
    version_pkg_path = env.scratch_path / "version_pkg"
    version_pkg_path.joinpath("testpkg").mkdir()
    pkg_path = version_pkg_path / "testpkg"

    pkg_path.joinpath("__init__.py").write_text("# hello there")
    _create_main_file(pkg_path, name="version_pkg", output="0.1")
    version_pkg_path.joinpath("setup.py").write_text(
        textwrap.dedent("""\
                        from setuptools import setup, find_packages
                        setup(name='version_pkg',
                              version='0.1',
                              packages=find_packages(),
                             )
                        """))
    env.run("git", "init", cwd=version_pkg_path)
    env.run("git", "add", ".", cwd=version_pkg_path)
    _git_commit(env, version_pkg_path, message="initial version")

    submodule_path = _create_test_package_submodule(env)

    env.run(
        "git",
        "submodule",
        "add",
        submodule_path,
        rel_path,
        cwd=version_pkg_path,
    )
    _git_commit(env, version_pkg_path, message="initial version w submodule")

    return version_pkg_path, submodule_path
Exemplo n.º 4
0
def _create_test_package_with_submodule(env, rel_path):
    """
    Args:
      rel_path: the location of the submodule relative to the superproject.
    """
    env.scratch_path.joinpath("version_pkg").mkdir()
    version_pkg_path = env.scratch_path / 'version_pkg'
    version_pkg_path.joinpath("testpkg").mkdir()
    pkg_path = version_pkg_path / 'testpkg'

    pkg_path.joinpath("__init__.py").write_text("# hello there")
    _create_main_file(pkg_path, name="version_pkg", output="0.1")
    version_pkg_path.joinpath("setup.py").write_text(
        textwrap.dedent('''\
                        from setuptools import setup, find_packages
                        setup(name='version_pkg',
                              version='0.1',
                              packages=find_packages(),
                             )
                        '''))
    env.run('git', 'init', cwd=version_pkg_path, expect_error=True)
    env.run('git', 'add', '.', cwd=version_pkg_path, expect_error=True)
    _git_commit(env, version_pkg_path, message='initial version')

    submodule_path = _create_test_package_submodule(env)

    env.run(
        'git',
        'submodule',
        'add',
        submodule_path,
        rel_path,
        cwd=version_pkg_path,
        expect_error=True,
    )
    _git_commit(env, version_pkg_path, message='initial version w submodule')

    return version_pkg_path, submodule_path
Exemplo n.º 5
0
def _create_test_package_with_submodule(env, rel_path):
    """
    Args:
      rel_path: the location of the submodule relative to the superproject.
    """
    env.scratch_path.join("version_pkg").mkdir()
    version_pkg_path = env.scratch_path / 'version_pkg'
    version_pkg_path.join("testpkg").mkdir()
    pkg_path = version_pkg_path / 'testpkg'

    pkg_path.join("__init__.py").write("# hello there")
    _create_main_file(pkg_path, name="version_pkg", output="0.1")
    version_pkg_path.join("setup.py").write(textwrap.dedent('''\
                        from setuptools import setup, find_packages
                        setup(name='version_pkg',
                              version='0.1',
                              packages=find_packages(),
                             )
                        '''))
    env.run('git', 'init', cwd=version_pkg_path, expect_error=True)
    env.run('git', 'add', '.', cwd=version_pkg_path, expect_error=True)
    _git_commit(env, version_pkg_path, message='initial version')

    submodule_path = _create_test_package_submodule(env)

    env.run(
        'git',
        'submodule',
        'add',
        submodule_path,
        rel_path,
        cwd=version_pkg_path,
        expect_error=True,
    )
    _git_commit(env, version_pkg_path, message='initial version w submodule')

    return version_pkg_path, submodule_path