143 lines
4.5 KiB
INI
143 lines
4.5 KiB
INI
# tox (https://tox.readthedocs.io/) is a tool for running tests
|
|
# 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]
|
|
isolated_build = true
|
|
envlist = begin,py310,py311,coverage,security,lint
|
|
|
|
[testenv]
|
|
allow_externals = pytest, coverage
|
|
deps =
|
|
-rrequirements/requirements-dev.txt
|
|
|
|
[testenv:build]
|
|
# require setuptools when building
|
|
deps = setuptools
|
|
|
|
[testenv:begin]
|
|
# clean up potential previous coverage runs
|
|
skip_install = true
|
|
commands = coverage erase
|
|
|
|
[testenv:py310]
|
|
# run pytest with coverage
|
|
commands =
|
|
pytest --cov-append --cov-branch \
|
|
--cov={envsitepackagesdir}/acro/ \
|
|
--cov={envsitepackagesdir}/countdown/ \
|
|
--cov={envsitepackagesdir}/dice/ \
|
|
--cov={envsitepackagesdir}/dispatch/ \
|
|
--cov={envsitepackagesdir}/dr_botzo/ \
|
|
--cov={envsitepackagesdir}/facts/ \
|
|
--cov={envsitepackagesdir}/history/ \
|
|
--cov={envsitepackagesdir}/ircbot/ \
|
|
--cov={envsitepackagesdir}/karma/ \
|
|
--cov={envsitepackagesdir}/markov/ \
|
|
--cov={envsitepackagesdir}/mpdbot/ \
|
|
--cov={envsitepackagesdir}/pi/ \
|
|
--cov={envsitepackagesdir}/races/ \
|
|
--cov={envsitepackagesdir}/seen/ \
|
|
--cov={envsitepackagesdir}/storycraft/ \
|
|
--cov={envsitepackagesdir}/text_manip/ \
|
|
--cov={envsitepackagesdir}/transform/ \
|
|
--cov={envsitepackagesdir}/weather/
|
|
|
|
[testenv:py311]
|
|
# run pytest with coverage
|
|
commands =
|
|
pytest --cov-append --cov-branch \
|
|
--cov={envsitepackagesdir}/acro/ \
|
|
--cov={envsitepackagesdir}/countdown/ \
|
|
--cov={envsitepackagesdir}/dice/ \
|
|
--cov={envsitepackagesdir}/dispatch/ \
|
|
--cov={envsitepackagesdir}/dr_botzo/ \
|
|
--cov={envsitepackagesdir}/facts/ \
|
|
--cov={envsitepackagesdir}/history/ \
|
|
--cov={envsitepackagesdir}/ircbot/ \
|
|
--cov={envsitepackagesdir}/karma/ \
|
|
--cov={envsitepackagesdir}/markov/ \
|
|
--cov={envsitepackagesdir}/mpdbot/ \
|
|
--cov={envsitepackagesdir}/pi/ \
|
|
--cov={envsitepackagesdir}/races/ \
|
|
--cov={envsitepackagesdir}/seen/ \
|
|
--cov={envsitepackagesdir}/storycraft/ \
|
|
--cov={envsitepackagesdir}/text_manip/ \
|
|
--cov={envsitepackagesdir}/transform/ \
|
|
--cov={envsitepackagesdir}/weather/
|
|
|
|
[testenv:coverage]
|
|
# report on coverage runs from above
|
|
skip_install = true
|
|
commands =
|
|
coverage report --fail-under=95 --show-missing
|
|
|
|
[testenv:security]
|
|
# run security checks
|
|
#
|
|
# again it seems the most valuable here to run against the packaged code
|
|
# might not need to ignore 51457 after a tox bump
|
|
commands =
|
|
bandit \
|
|
{envsitepackagesdir}/acro/ \
|
|
{envsitepackagesdir}/countdown/ \
|
|
{envsitepackagesdir}/dice/ \
|
|
{envsitepackagesdir}/dispatch/ \
|
|
{envsitepackagesdir}/dr_botzo/ \
|
|
{envsitepackagesdir}/facts/ \
|
|
{envsitepackagesdir}/history/ \
|
|
{envsitepackagesdir}/ircbot/ \
|
|
{envsitepackagesdir}/karma/ \
|
|
{envsitepackagesdir}/markov/ \
|
|
{envsitepackagesdir}/mpdbot/ \
|
|
{envsitepackagesdir}/pi/ \
|
|
{envsitepackagesdir}/races/ \
|
|
{envsitepackagesdir}/seen/ \
|
|
{envsitepackagesdir}/storycraft/ \
|
|
{envsitepackagesdir}/text_manip/ \
|
|
{envsitepackagesdir}/transform/ \
|
|
{envsitepackagesdir}/weather/ \
|
|
-r
|
|
safety check -r requirements/requirements-dev.txt -i 51457
|
|
|
|
[testenv:lint]
|
|
# run style checks
|
|
commands =
|
|
flake8
|
|
- flake8 --disable-noqa --ignore= --select=E,W,F,C,D,A,G,B,I,T,M,DUO
|
|
|
|
[coverage:paths]
|
|
source =
|
|
./
|
|
.tox/**/site-packages/
|
|
|
|
[coverage:run]
|
|
branch = True
|
|
|
|
# redundant with pytest --cov above, but this tricks the coverage.xml report into
|
|
# using the full path, otherwise files with the same name in different paths
|
|
# get clobbered. maybe appends would fix this, IDK
|
|
include =
|
|
{envsitepackagesdir}/acro/
|
|
{envsitepackagesdir}/countdown/
|
|
{envsitepackagesdir}/dice/
|
|
{envsitepackagesdir}/dispatch/
|
|
{envsitepackagesdir}/dr_botzo/
|
|
{envsitepackagesdir}/facts/
|
|
{envsitepackagesdir}/history/
|
|
{envsitepackagesdir}/ircbot/
|
|
{envsitepackagesdir}/karma/
|
|
{envsitepackagesdir}/markov/
|
|
{envsitepackagesdir}/mpdbot/
|
|
{envsitepackagesdir}/pi/
|
|
{envsitepackagesdir}/races/
|
|
{envsitepackagesdir}/seen/
|
|
{envsitepackagesdir}/storycraft/
|
|
{envsitepackagesdir}/text_manip/
|
|
{envsitepackagesdir}/transform/
|
|
{envsitepackagesdir}/weather/
|
|
|
|
omit =
|
|
**/_version.py
|