Ejemplo n.º 1
0
def xdoctest(session: Session) -> None:
    """Run examples with xdoctest."""
    args = session.posargs or ["all"]
    session.run("poetry", "install", "--no-dev", external=True)
    session.install("xdoctest")
    session.run("python", "-m", "xdoctest", package, *args)
def black(session: Session) -> None:
    """Run black code formatter."""
    args = session.posargs or locations
    session.install("black")
    session.run("black", *args)
def pytype(session: Session) -> None:
    """Run the static type checker using pytype."""
    args = session.posargs or ["--disable=import-error", *locations]
    session.install("pytype")
    session.run("pytype", *args)
Ejemplo n.º 4
0
Archivo: noxfile.py Proyecto: PrQL/prql
def tests(session: Session) -> None:
    """Run the test suite with pytest."""
    print('CWD', os.getcwd())
    session.install("-v", "--no-index", f"--find-links={Path('..', 'dist')}", "prql_python")
    session.install("-v", "-r", "requirements.txt")
    session.run("pytest", str(Path("python", "tests")))
Ejemplo n.º 5
0
def mypy(session: Session) -> None:
    """Type-check using mypy."""
    session.install(".")
    install_with_constraints(session, "invoke", "mypy")
    session.run("inv", "mypy")
def publish_release(session: Session) -> None:
    """Publish a GitHub release."""
    args = [f"--owner={owner}", f"--repository={repository}", *session.posargs]
    session.install("click", "github3.py")
    session.run("python", "tools/publish-github-release.py", *args, external=True)
Ejemplo n.º 7
0
def typeguard(session: Session) -> None:
    """Runtime type checking using Typeguard."""
    session.install(".")
    session.install("pytest", "typeguard", "pygments", "pytest-asyncio",
                    "aioresponses")
    session.run("pytest", f"--typeguard-packages={package}", *session.posargs)
Ejemplo n.º 8
0
def pydocstyle(session: Session) -> None:
    """Check docstrings."""
    session.install("pydocstyle")
    session.run("pydocstyle")
Ejemplo n.º 9
0
def isort(session: Session) -> None:
    """Run isort formatter."""  # TODO: remove
    args = session.posargs or locations
    session.install("isort")
    session.run("isort", *args)
Ejemplo n.º 10
0
def black(session: Session) -> None:
    """Check black."""
    session.install("black==19.3b0")
    session.run("black", "--check", ".")
Ejemplo n.º 11
0
def mypy(session: Session) -> None:
    """Check mypy."""
    session.install("mypy")
    session.run("mypy", ".")
Ejemplo n.º 12
0
def test_patch(session: Session) -> None:
    """It patches Session.install."""
    import nox_poetry.patch  # noqa: F401

    Session.install(session, ".")
Ejemplo n.º 13
0
def apply_format(session: Session) -> None:
    """Apply formating rules to the selected files."""
    session.install(*form_requirements)
    session.run("i", "-l", "79", *python_files, silent=False)
    session.run("isort", "-rc", *python_files, silent=False)
Ejemplo n.º 14
0
def docs(session: Session) -> None:
    """Build the documentation."""
    session.run("poetry", "install", "--no-dev", external=True)
    session.install("sphinx", "sphinx_autodoc_typehints")
    session.run("sphinx-build", "docs", "docs/_build")
Ejemplo n.º 15
0
def coverage(session: Session) -> None:
    """Upload coverage data."""
    session.install("coverage[toml]", "codecov")
    session.run("coverage", "xml", "--fail-under=0")
    session.run("codecov", *session.posargs)
Ejemplo n.º 16
0
def types(session: Session) -> None:
    args = session.posargs or locations
    session.install("mypy")
    session.run("mypy", *args)
Ejemplo n.º 17
0
def black(session: Session) -> None:
    args = session.posargs or locations
    session.install("black", "blackdoc")
    session.run("black", *args)
    session.run("blackdoc", *args)
Ejemplo n.º 18
0
def safety(session: Session) -> None:
    session.install("safety")
    session.run("safety", "check", "--file=requirements.txt", "--full-report")
Ejemplo n.º 19
0
def tests(session: Session) -> None:
    """Run tests."""
    args = session.posargs + ["--cov=morfeus", "--import-mode=importlib", "-s"]
    session.install("pytest", "pytest-cov")
    session.install(".")
    session.run("pytest", *args)
Ejemplo n.º 20
0
def requirements(session: Session) -> None:
    args = session.posargs or ["-o", "requirements.txt", "requirements.in"]
    session.install("pip-tools")
    session.run("pip-compile", *args)
Ejemplo n.º 21
0
def safety(session: Session) -> None:
    """Scan dependencies for insecure packages."""
    requirements = nox_poetry.export_requirements(session)
    session.install("safety")
    session.run("safety", "check", f"--file={requirements}", "--bare")
Ejemplo n.º 22
0
def changelog(session: Session) -> None:
    args = session.posargs or ["--unreleased"]
    session.install("auto-changelog")
    session.run("auto-changelog", *args)
Ejemplo n.º 23
0
def mypy(session: Session) -> None:
    """Nox session for running static type analysis."""
    args = session.posargs or locations
    session.install("mypy")
    session.run("mypy", *args)
def docs_deploy(session: Session) -> None:
    """Deploy the documentation on Github Pages."""
    args = session.posargs
    session.install("-r", "docs/requirements.txt")
    session.run("mkdocs", "gh-deploy", *args)
def contract_tests(session: Session) -> None:
    """Run the contract_test suite."""
    args = session.posargs
    session.install(".", "pytest", "pytest-docker")
    session.run("pytest", "-m contract", *args)
Ejemplo n.º 26
0
def generate_news(session: Session, version: str) -> None:
    session.install("towncrier")
    session.run("towncrier", "--yes", "--version", version, silent=True)
def mypy(session: Session) -> None:
    """Type-check using mypy."""
    args = session.posargs or locations
    session.install("mypy")
    session.run("mypy", *args)
Ejemplo n.º 28
0
def tests(session: Session) -> None:
    session.install(".")
    session.install("pytest", "coverage[toml]", "hypothesis", "pytest-cov")
    session.run("poetry", "install", external=True)
    session.run("pytest", "--cov")
def xdoctest(session: Session) -> None:
    """Run examples with xdoctest."""
    args = session.posargs or ["all"]
    session.install(".", "xdoctest")
    session.run("python", "-m", "xdoctest", package, *args)
Ejemplo n.º 30
0
def typeguard(session: Session) -> None:
    """Runtime type checking using Typeguard."""
    session.install(".")
    session.install("pytest", "typeguard", "pygments", "requests_mock")
    session.run("pytest", f"--typeguard-packages={package}", *session.posargs)