Drop auxiliary requirements files

Move the contents of test-requirements.txt and doc/requirements.txt
into pyproject.toml as project.optional-dependencies (a.k.a.
"extras"). The requirements.txt format is considered pip-specific
and nonstandard.

While we're at it, fine-tune these per test environment.

Change-Id: I477b9685e5d1159086b7a38c9322e07b7c43e2e9
This commit is contained in:
Jeremy Stanley 2025-02-04 15:31:25 +00:00
parent b8eb765c27
commit 09f16f6071
5 changed files with 32 additions and 24 deletions

View File

@ -32,11 +32,11 @@ testr arguments that are needed to nox. For example, you can run:
It is also possible to run the tests inside of a virtual environment
you have created, or it is possible that you have all of the dependencies
installed locally already. If you'd like to go this route, the requirements
are listed in pyproject.toml and the requirements for testing are in
test-requirements.txt. Installing them via pip, for instance, is simply::
are listed in pyproject.toml and the requirements for testing are in package
extras defined with project.optional-dependencies entries. Installing them
via pip, for instance, is simply::
pip install -r test-requirements.txt
pip install -e .
pip install -e .[test-unit]
In you go this route, you can interact with the testr command directly.
Running `testr run` will run the entire test suite. `testr run --parallel`

View File

@ -1,6 +0,0 @@
reno>=2.8.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,!=2.1.0 # BSD
sphinxcontrib-programoutput # BSD license
# needed because we use autodoc to document our tests in the dev docs
fixtures>=0.3.12

View File

@ -11,14 +11,13 @@ nox.options.sessions = ["tests-3", "linters"]
# version using --force-python.
@nox.session(python="3")
def linters(session):
session.install("hacking>=7,<8")
session.install(".[test-linters]")
session.run("flake8")
@nox.session(python="3")
def docs(session):
session.install("-r", "doc/requirements.txt")
session.install(".")
session.install(".[build-docs]")
session.run(
"sphinx-build", "-W",
"-d", "doc/build/doctrees",
@ -29,24 +28,21 @@ def docs(session):
@nox.session(python="3")
def venv(session):
session.install("-r", "test-requirements.txt")
session.install("-e", ".")
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):
session.install("-r", "test-requirements.txt")
session.install("-e", ".")
session.install("-e", ".[test-unit]")
session.run("stestr", "run", *session.posargs)
session.run("stestr", "slowest")
@nox.session(python="3")
def cover(session):
session.install("-r", "test-requirements.txt")
session.install("-e", ".")
session.install("-e", ".[test-cover]")
session.env["PYTHON"] = "coverage run --source bindep --parallel-mode"
session.run("stestr", "run", *session.posargs)
session.run("stestr", "slowest")

View File

@ -55,6 +55,29 @@ name = "bindep"
readme = {charset = "UTF-8", content-type = "text/x-rst", file = "README.rst"}
requires-python = ">=3.7"
[project.optional-dependencies]
build-docs = [
# needed because we use autodoc to document our tests in the dev docs
"fixtures>=0.3.12",
"reno>=2.8.0", # Apache-2.0
"sphinx!=1.6.6,!=1.6.7,!=2.1.0", # BSD
"sphinxcontrib-programoutput", # BSD license
]
test-cover = [
"bindep[test-unit]",
"coverage>=3.6",
]
test-linters = [
"hacking>=7,<8"
]
test-unit = [
"fixtures>=0.3.12",
"python-subunit",
"stestr>=1",
"testtools>=0.9.27",
]
[project.scripts]
bindep = "bindep.__main__:main"

View File

@ -1,5 +0,0 @@
coverage>=3.6
fixtures>=0.3.12
python-subunit
stestr>=1.0.0 # Apache-2.0
testtools>=0.9.27