Ejemplo n.º 1
0
def test_freeze_git_clone_srcdir(script: PipTestEnvironment) -> None:
    """
    Test freezing a Git clone where setup.py is in a subdirectory
    relative the repo root and the source code is in a subdirectory
    relative to setup.py.
    """
    # Returns path to a generated package called "version_pkg"
    pkg_version = _create_test_package_with_srcdir(script)

    result = script.run(
        "git",
        "clone",
        pkg_version,
        "pip-test-package",
        expect_stderr=True,
    )
    repo_dir = script.scratch_path / "pip-test-package"
    result = script.run(
        "python",
        "setup.py",
        "develop",
        cwd=repo_dir / "subdir",
        expect_stderr=True,
    )
    result = script.pip("freeze", expect_stderr=True)
    expected = textwrap.dedent("""
            ...-e git+...#egg=version_pkg&subdirectory=subdir
            ...
        """).strip()
    _check_output(result.stdout, expected)
Ejemplo n.º 2
0
def test_freeze_mercurial_clone_srcdir(script, tmpdir):
    """
    Test freezing a Mercurial clone where setup.py is in a subdirectory
    relative to the repo root and the source code is in a subdirectory
    relative to setup.py.
    """
    # Returns path to a generated package called "version_pkg"
    pkg_version = _create_test_package_with_srcdir(script, vcs='hg')

    result = script.run('hg', 'clone', pkg_version, 'pip-test-package')
    repo_dir = script.scratch_path / 'pip-test-package'
    result = script.run('python',
                        'setup.py',
                        'develop',
                        cwd=repo_dir / 'subdir')
    result = script.pip('freeze')
    expected = textwrap.dedent("""
            ...-e hg+...#egg=version_pkg&subdirectory=subdir
            ...
        """).strip()
    _check_output(result.stdout, expected)

    result = script.pip('freeze', '-f', '%s#egg=pip_test_package' % repo_dir)
    expected = textwrap.dedent(
        """
            -f %(repo)s#egg=pip_test_package...
            -e hg+...#egg=version_pkg&subdirectory=subdir
            ...
        """ % {
            'repo': repo_dir
        }, ).strip()
    _check_output(result.stdout, expected)
Ejemplo n.º 3
0
def test_freeze_git_clone_srcdir(script, tmpdir):
    """
    Test freezing a Git clone where setup.py is in a subdirectory
    relative the repo root and the source code is in a subdirectory
    relative to setup.py.
    """
    # Returns path to a generated package called "version_pkg"
    pkg_version = _create_test_package_with_srcdir(script)

    result = script.run(
        'git',
        'clone',
        pkg_version,
        'pip-test-package',
        expect_stderr=True,
    )
    repo_dir = script.scratch_path / 'pip-test-package'
    result = script.run(
        'python',
        'setup.py',
        'develop',
        cwd=repo_dir / 'subdir',
        expect_stderr=True,
    )
    result = script.pip('freeze', expect_stderr=True)
    expected = textwrap.dedent("""
            ...-e git+...#egg=version_pkg&subdirectory=subdir
            ...
        """).strip()
    _check_output(result.stdout, expected)
Ejemplo n.º 4
0
def test_freeze_git_clone_srcdir(script, tmpdir):
    """
    Test freezing a Git clone where setup.py is in a subdirectory
    relative the repo root and the source code is in a subdirectory
    relative to setup.py.
    """
    # Returns path to a generated package called "version_pkg"
    pkg_version = _create_test_package_with_srcdir(script)

    result = script.run(
        'git', 'clone', pkg_version, 'pip-test-package',
        expect_stderr=True,
    )
    repo_dir = script.scratch_path / 'pip-test-package'
    result = script.run(
        'python', 'setup.py', 'develop',
        cwd=repo_dir / 'subdir',
        expect_stderr=True,
    )
    result = script.pip('freeze', expect_stderr=True)
    expected = textwrap.dedent(
        """
            ...-e git+...#egg=version_pkg&subdirectory=subdir
            ...
        """
    ).strip()
    _check_output(result.stdout, expected)

    result = script.pip(
        'freeze', '-f', '%s#egg=pip_test_package' % repo_dir,
        expect_stderr=True,
    )
    expected = textwrap.dedent(
        """
            -f %(repo)s#egg=pip_test_package...
            -e git+...#egg=version_pkg&subdirectory=subdir
            ...
        """ % {'repo': repo_dir},
    ).strip()
    _check_output(result.stdout, expected)
Ejemplo n.º 5
0
def test_freeze_mercurial_clone_srcdir(script: PipTestEnvironment) -> None:
    """
    Test freezing a Mercurial clone where setup.py is in a subdirectory
    relative to the repo root and the source code is in a subdirectory
    relative to setup.py.
    """
    # Returns path to a generated package called "version_pkg"
    pkg_version = _create_test_package_with_srcdir(script.scratch_path,
                                                   vcs="hg")

    result = script.run("hg", "clone", os.fspath(pkg_version),
                        "pip-test-package")
    repo_dir = script.scratch_path / "pip-test-package"
    result = script.run("python",
                        "setup.py",
                        "develop",
                        cwd=repo_dir / "subdir")
    result = script.pip("freeze")
    expected = textwrap.dedent("""
            ...-e hg+...#egg=version_pkg&subdirectory=subdir
            ...
        """).strip()
    _check_output(result.stdout, expected)