2019-02-21 09:39:06 +00:00
|
|
|
# Tox (https://tox.readthedocs.io/en/latest/) is a tool for running tests
|
2014-04-20 20:15:19 +00:00
|
|
|
# in multiple virtualenvs. This configuration file will run the
|
|
|
|
|
# test suite on all supported python versions. To use it, "pip install tox"
|
|
|
|
|
# and then run "tox" from this directory.
|
|
|
|
|
|
|
|
|
|
[tox]
|
2022-03-09 11:03:09 +00:00
|
|
|
isolated_build=true
|
2021-12-14 10:56:22 +00:00
|
|
|
envlist = lint,docs,py
|
2019-07-11 12:27:49 +00:00
|
|
|
skipsdist = true
|
2014-04-20 20:15:19 +00:00
|
|
|
|
|
|
|
|
[testenv]
|
|
|
|
|
commands =
|
2021-07-01 16:19:39 +00:00
|
|
|
python3 --version
|
2024-12-10 18:02:34 +00:00
|
|
|
python3 -m coverage run -m unittest
|
2024-12-10 18:21:12 +00:00
|
|
|
python3 -m coverage report -m --fail-under 97
|
2014-04-20 20:15:19 +00:00
|
|
|
|
|
|
|
|
deps =
|
2023-02-06 11:18:19 +00:00
|
|
|
-r{toxinidir}/requirements/test.txt
|
2015-06-01 21:32:07 +00:00
|
|
|
|
2021-07-01 16:19:39 +00:00
|
|
|
install_command = python3 -m pip install {opts} {packages}
|
2019-09-16 16:42:46 +00:00
|
|
|
|
2023-01-02 09:56:46 +00:00
|
|
|
# Workaround https://github.com/tox-dev/tox/issues/2801 (python3 not allowed in Windows)
|
|
|
|
|
allowlist_externals = python3
|
|
|
|
|
|
2023-03-02 08:35:14 +00:00
|
|
|
# Develop test env to run tests against securesystemslib's main branch
|
|
|
|
|
# Must to be invoked explicitly with, e.g. `tox -e with-sslib-main`
|
|
|
|
|
[testenv:with-sslib-main]
|
2021-08-26 07:03:59 +00:00
|
|
|
commands_pre =
|
2024-12-11 08:29:13 +00:00
|
|
|
python3 -m pip install --force-reinstall git+https://github.com/secure-systems-lab/securesystemslib.git@main#egg=securesystemslib[crypto]
|
2019-09-16 16:42:46 +00:00
|
|
|
|
|
|
|
|
commands =
|
2024-12-10 18:02:34 +00:00
|
|
|
python3 -m coverage run -m unittest
|
2024-12-10 18:21:12 +00:00
|
|
|
python3 -m coverage report -m
|
2020-10-15 11:24:52 +00:00
|
|
|
|
|
|
|
|
[testenv:lint]
|
2023-02-02 11:21:31 +00:00
|
|
|
deps =
|
2023-02-06 11:18:19 +00:00
|
|
|
-r{toxinidir}/requirements/lint.txt
|
2024-07-10 11:52:28 +00:00
|
|
|
lint_dirs = tuf examples tests verify_release .github/scripts
|
2024-02-22 13:55:00 +00:00
|
|
|
passenv = RUFF_OUTPUT_FORMAT
|
2020-10-15 11:24:52 +00:00
|
|
|
commands =
|
2024-02-20 05:34:47 +00:00
|
|
|
ruff check {[testenv:lint]lint_dirs}
|
2024-02-18 05:38:05 +00:00
|
|
|
ruff format --diff {[testenv:lint]lint_dirs}
|
Require black and isort in tuf/api/* via tox
Configure lint build in tox.ini to check if code in tuf/api/* is
formatted according to black and isort style rules:
https://black.readthedocs.io/en/stable/the_black_code_style.html
https://pycqa.github.io/isort/
In addition to our new style guide (#1128) and corresponding linter
configuration, requiring auto-formatting should help to further
reduce reviewing effort. The auto-formatter black was chosen for
the following reasons:
- It seems to be the most popular formatter in the Python ecosystem
- It is well documented including integration instructions with
most of the tools we use (git, GitHub Actions, pylint, a range of
editors, pyproject.toml #1161)
- It checks that the reformatted code produces a valid AST that is
equivalent to the original
- It has almost no ways of customization, which means no
customization effort required, and more (cross-project) style
uniformity, lowering contribution barriers
- It converts single to double quotes, where reasonable, which is
exactly what we recommend
- The style choices it makes seem generally reasonable and don't
conflict with our style guide, except for favoring hanging over
aligned indentation, which is the opposite of what we recommend.
But we are willing to update the adapt our style guide.
Auto-format pre-commit configuration will be added in a subsequent
commit.
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-03-11 17:03:08 +00:00
|
|
|
|
2021-12-13 16:28:53 +00:00
|
|
|
mypy {[testenv:lint]lint_dirs}
|
2025-08-15 09:24:08 +00:00
|
|
|
zizmor -q .
|
2024-02-20 05:34:47 +00:00
|
|
|
|
2024-03-07 10:01:03 +00:00
|
|
|
[testenv:fix]
|
|
|
|
|
deps = {[testenv:lint]deps}
|
|
|
|
|
commands =
|
|
|
|
|
ruff check --fix {[testenv:lint]lint_dirs}
|
|
|
|
|
ruff format {[testenv:lint]lint_dirs}
|
|
|
|
|
|
2021-08-09 12:47:47 +00:00
|
|
|
[testenv:docs]
|
|
|
|
|
deps =
|
2023-02-06 11:18:19 +00:00
|
|
|
-r{toxinidir}/requirements/docs.txt
|
2021-08-09 12:47:47 +00:00
|
|
|
|
|
|
|
|
commands =
|
2025-02-20 09:27:52 +00:00
|
|
|
sphinx-build --fail-on-warning --quiet --builder html docs docs/build/html
|