コード例 #1
0
ファイル: noxfile.py プロジェクト: tfwillems/pandera
def tests(session: Session, pandas: str, extra: str) -> None:
    """Run the test suite."""

    # skip these conditions
    python = (session.python
              or f"{sys.version_info.major}.{sys.version_info.minor}")
    if ((pandas, extra) in {
        ("1.1.5", "koalas"),
        ("1.1.5", "modin-dask"),
        ("1.1.5", "modin-ray"),
    } or (python, pandas, extra) in {
        ("3.10", "1.1.5", "modin-dask"),
        ("3.10", "1.1.5", "modin-ray"),
    } or (python, extra) in {
        ("3.7", "modin-dask"),
        ("3.7", "modin-ray"),
        ("3.10", "modin-dask"),
        ("3.10", "modin-ray"),
        ("3.10", "koalas"),
    }):
        session.skip()

    install_extras(session, extra, pandas=pandas)

    env = {}
    if extra.startswith("modin"):
        extra, engine = extra.split("-")
        if engine not in {"dask", "ray"}:
            raise ValueError(f"{engine} is not a valid modin engine")
        env = {"CI_MODIN_ENGINES": engine}

    if session.posargs:
        args = session.posargs
    else:
        path = f"tests/{extra}/" if extra != "all" else "tests"
        args = []
        if extra == "strategies":
            # strategies tests runs very slowly in python 3.7:
            # https://github.com/pandera-dev/pandera/issues/556
            # as a stop-gap, use the "dev" profile for 3.7
            profile = "ci" if CI_RUN and session.python != "3.7" else "dev"
            # enable threading via pytest-xdist
            args = [
                "-n=auto",
                "-q",
                f"--hypothesis-profile={profile}",
            ]
        args += [
            f"--cov={PACKAGE}",
            "--cov-report=term-missing",
            "--cov-report=xml",
            "--cov-append",
            "--verbosity=10",
        ]
        if not CI_RUN:
            args.append("--cov-report=html")
        args.append(path)

    session.run("pytest", *args, env=env)
コード例 #2
0
ファイル: noxfile.py プロジェクト: tfwillems/pandera
def docs(session: Session) -> None:
    """Build the documentation."""
    # this is needed until ray and geopandas are supported on python 3.10
    if session.python == "3.10":
        session.skip()

    install_extras(session, extra="all", force_pip=True)
    session.chdir("docs")

    # build html docs
    if not CI_RUN and not session.posargs:
        shutil.rmtree("_build", ignore_errors=True)
        shutil.rmtree(
            os.path.join("source", "reference", "generated"),
            ignore_errors=True,
        )
        for builder in ["doctest", "html"]:
            session.run(
                "sphinx-build",
                "-W",
                "-T",
                f"-b={builder}",
                "-d",
                os.path.join("_build", "doctrees", ""),
                "source",
                os.path.join("_build", builder, ""),
            )
    else:
        shutil.rmtree(os.path.join("_build"), ignore_errors=True)
        args = session.posargs or [
            "-v",
            "-W",
            "-E",
            "-b=doctest",
            "source",
            "_build",
        ]
        session.run("sphinx-build", *args)