engagement/noxfile.py
Jeremy Stanley 3242fadc59 Add a convenience entrypoint for maintainers.py
This will make iterating on improvements to the script and
subsequent use easier. Note that for now the script itself is still
broken, relying on systems that have changed in the decade or more
since it was last relied on.

Change-Id: If42d76e51e867f54e10191bb130d5f7590f67029
2025-03-25 14:43:56 +00:00

71 lines
2.1 KiB
Python

import nox
nox.options.error_on_external_run = True
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["tests-3", "linters"]
# Convenience wrapper for stats generation
@nox.session(python="3")
def stats(session):
session.install(".")
session.run("engagement-stats", *session.posargs)
# Convenience wrapper for maintainer list querying
@nox.session(python="3")
def maintainers(session):
session.install(".")
session.run("engagement-maintainers", *session.posargs)
# Note setting python this way seems to give us a target name without
# python specific suffixes while still allowing us to force a specific
# version using --force-python.
@nox.session(python="3")
def linters(session):
# TODO: switch this line to 'session.install("--group", "test-linters")'
session.install(".[test-linters]")
session.run("flake8")
@nox.session(python="3")
def docs(session):
# TODO: switch this line to 'session.install("--group", "build-docs")'
session.install(".[build-docs]")
session.run(
"sphinx-build", "-W",
"-d", "doc/build/doctrees",
"-b", "html",
"doc/source/", "doc/build/html"
)
@nox.session(python="3")
def venv(session):
# TODO: switch to 'session.install("-e", ".", "--group", "test-unit")'
session.install("-e", ".[test-unit]")
session.run(*session.posargs)
# This will attempt to run python3 tests by default.
@nox.session(python=["3"])
def tests(session):
# TODO: switch to 'session.install("-e", ".", "--group", "test-unit")'
session.install("-e", ".[test-unit]")
session.run("stestr", "run", *session.posargs)
session.run("stestr", "slowest")
@nox.session(python="3")
def cover(session):
# TODO: switch to 'session.install("-e", ".", "--group", "test-cover")'
session.install("-e", ".[test-cover]")
session.env["PYTHON"] = "coverage run --source engagement --parallel-mode"
session.run("stestr", "run", *session.posargs)
session.run("stestr", "slowest")
session.run("coverage", "combine")
session.run("coverage", "html", "-d", "cover")
session.run("coverage", "xml", "-o", "cover/coverage.xml")