def test_install_dependency_without_patch(
    project: Project,
    run_nox_with_noxfile: RunNoxWithNoxfile,
    list_packages: ListPackages,
) -> None:
    """It installs the pinned dependency."""
    @nox.session
    def test(session: nox.sessions.Session) -> None:
        """Install the dependency."""
        nox_poetry.install(session, "pycodestyle")

    run_nox_with_noxfile([test], [nox, nox.sessions, nox_poetry])

    expected = [project.get_dependency("pycodestyle")]
    packages = list_packages(test)

    assert set(expected) == set(packages)
def test_session_install_dependency(
    project: Project,
    run_nox_with_noxfile: RunNoxWithNoxfile,
    list_packages: ListPackages,
) -> None:
    """It installs the pinned dependency."""
    @nox_poetry.session
    def test(session: nox_poetry.Session) -> None:
        """Install the dependency."""
        session.install("pyflakes")

    run_nox_with_noxfile([test], [nox_poetry])

    expected = [project.get_dependency("pyflakes")]
    packages = list_packages(test)

    assert set(expected) == set(packages)
def test_install_local_wheel_with_extras(
    project: Project,
    run_nox_with_noxfile: RunNoxWithNoxfile,
    list_packages: ListPackages,
) -> None:
    """It installs the extra."""
    @nox.session
    def test(session: nox.sessions.Session) -> None:
        """Install the local package."""
        nox_poetry.install(session, ".[pygments]")

    run_nox_with_noxfile([test], [nox, nox.sessions, nox_poetry])

    expected = [
        project.package,
        *project.dependencies,
        project.get_dependency("pygments"),
    ]
    packages = list_packages(test)

    assert set(expected) == set(packages)
def test_install_local_wheel_and_dependency_using_patch(
    project: Project,
    run_nox_with_noxfile: RunNoxWithNoxfile,
    list_packages: ListPackages,
) -> None:
    """It installs the wheel with pinned dependencies."""
    @nox.session
    def test(session: nox.sessions.Session) -> None:
        """Install the dependency."""
        session.install(".", "pyflakes")

    run_nox_with_noxfile([test], [nox, nox.sessions, nox_poetry.patch])

    expected = [
        project.package,
        *project.dependencies,
        project.get_dependency("pyflakes"),
    ]
    packages = list_packages(test)

    assert set(expected) == set(packages)
def test_installroot_sdist_with_extras(
    project: Project,
    run_nox_with_noxfile: RunNoxWithNoxfile,
    list_packages: ListPackages,
) -> None:
    """It installs the extra."""
    @nox.session
    def test(session: nox.sessions.Session) -> None:
        """Install the local package."""
        nox_poetry.installroot(session,
                               distribution_format=nox_poetry.SDIST,
                               extras=["pygments"])

    run_nox_with_noxfile([test], [nox, nox.sessions, nox_poetry])

    expected = [
        project.package,
        *project.dependencies,
        project.get_dependency("pygments"),
    ]
    packages = list_packages(test)

    assert set(expected) == set(packages)