bindep/noxfile.py
Jeremy Stanley 2113b3ea41 Update for newer Python, Tox and Hacking
Small but overdue fix for Tox v4 support, switch to newer Hacking so
that we can test on more recent Python versions, and update the
Trove classifiers to indicate the newer jobs we're running. Also
drop Python 2.7 from the envlist since we stopped supporting it
previously, and do the same for nox for symmetry.

Remove python-dev-all from the sample bindep.txt used for testing,
since that package no longer exists on Noble.

Clean up a missed Python 2.7 workaround in setup.py as well.

Note that while we're not yet testing with Python 3.13, I ran unit
tests on it locally and everything seems to be working.

Change-Id: Ifdd15e06269b0768ef2cb6c75894dbfcdbba7a4e
2025-01-06 17:10:06 +00:00

60 lines
1.7 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")
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")
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")
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")