
setup.py is still required as the build_meta entrypoints PBR uses execute setup.py, but only needs to set the pbr attribute to True now. Really what this change gets us is control over the version of SetupTools and PBR that are used, but much of the underlying machinery doesn't change. Some gymnastics are required in order to keep working with Python 3.6, due to Pip and SetupTools disagreeing on PEP 660 support with that interpreter version, but appropriate TODO comments are left as a reminder to simplify once we no longer care to support those platforms. Change-Id: If210b5f5b5b7b9bbcb2538c49fbe7a5f7b8260ed
72 lines
2.2 KiB
Python
72 lines
2.2 KiB
Python
import nox
|
|
|
|
|
|
nox.options.error_on_external_run = True
|
|
nox.options.reuse_existing_virtualenvs = True
|
|
nox.options.sessions = ["tests-3", "linters"]
|
|
|
|
|
|
# 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):
|
|
session.install("hacking>=7,<8")
|
|
session.run("flake8")
|
|
|
|
|
|
@nox.session(python="3")
|
|
def docs(session):
|
|
session.install("-r", "requirements.txt")
|
|
session.install("-r", "doc/requirements.txt")
|
|
session.install(".")
|
|
session.run(
|
|
"sphinx-build", "-W",
|
|
"-d", "doc/build/doctrees",
|
|
"-b", "html",
|
|
"doc/source/", "doc/build/html"
|
|
)
|
|
|
|
|
|
@nox.session(python="3")
|
|
def venv(session):
|
|
session.install("-r", "requirements.txt")
|
|
session.install("-r", "test-requirements.txt")
|
|
# TODO: clean this conditional up once Python 3.6 support is dropped
|
|
if session.python == "3.6":
|
|
session.install(".")
|
|
else:
|
|
session.install("-e", ".")
|
|
session.run(*session.posargs)
|
|
|
|
|
|
# This will attempt to run python3 tests by default.
|
|
@nox.session(python=["3"])
|
|
def tests(session):
|
|
session.install("-r", "requirements.txt")
|
|
session.install("-r", "test-requirements.txt")
|
|
# TODO: clean this conditional up once Python 3.6 support is dropped
|
|
if session.python == "3.6":
|
|
session.install(".")
|
|
else:
|
|
session.install("-e", ".")
|
|
session.run("stestr", "run", *session.posargs)
|
|
session.run("stestr", "slowest")
|
|
|
|
|
|
@nox.session(python="3")
|
|
def cover(session):
|
|
session.install("-r", "requirements.txt")
|
|
session.install("-r", "test-requirements.txt")
|
|
# TODO: clean this conditional up once Python 3.6 support is dropped
|
|
if session.python == "3.6":
|
|
session.install(".")
|
|
else:
|
|
session.install("-e", ".")
|
|
session.env["PYTHON"] = "coverage run --source bindep --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")
|