start using tox, despite 100000 errors

This commit is contained in:
Brian S. Stephan 2020-10-24 09:54:12 -05:00
parent 819bbe74c6
commit 10d73f570a
3 changed files with 203 additions and 20 deletions

2
.gitignore vendored
View File

@ -3,6 +3,8 @@ build/
dist/
tags/
*.egg-info/
.tox/
.coverage
dr.botzo.data
dr.botzo.cfg
localsettings.py

View File

@ -1,20 +0,0 @@
doc-warnings: true
strictness: high
ignore-paths:
- migrations
ignore-patterns:
- \.log$
- localsettings.py$
- parsetab.py$
pylint:
enable:
- relative-import
options:
max-line-length: 120
good-names: log
pep8:
options:
max-line-length: 120
pep257:
disable:
- D203

201
tox.ini Normal file
View File

@ -0,0 +1,201 @@
# 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]
envlist = begin,py36,py37,py38,coverage,security,lint,bundle
[testenv]
# build a wheel and test it
wheel = true
wheel_build_env = build
# whitelist commands we need
whitelist_externals = cp
# install everything via requirements-dev.txt, so that developer environment
# is the same as the tox environment (for ease of use/no weird gotchas in
# local dev results vs. tox results) and also to avoid ticky-tacky maintenance
# of "oh this particular env has weird results unless I install foo" --- just
# shotgun blast install everything everywhere
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:py36]
# 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}/gitlab_bot/ \
--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}/transform/ \
--cov={envsitepackagesdir}/twitter/ \
--cov={envsitepackagesdir}/weather/
[testenv:py37]
# 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}/gitlab_bot/ \
--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}/transform/ \
--cov={envsitepackagesdir}/twitter/ \
--cov={envsitepackagesdir}/weather/
[testenv:py38]
# 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}/gitlab_bot/ \
--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}/transform/ \
--cov={envsitepackagesdir}/twitter/ \
--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
commands =
bandit \
{envsitepackagesdir}/acro/ \
{envsitepackagesdir}/countdown/ \
{envsitepackagesdir}/dice/ \
{envsitepackagesdir}/dispatch/ \
{envsitepackagesdir}/dr_botzo/ \
{envsitepackagesdir}/facts/ \
{envsitepackagesdir}/gitlab_bot/ \
{envsitepackagesdir}/ircbot/ \
{envsitepackagesdir}/karma/ \
{envsitepackagesdir}/markov/ \
{envsitepackagesdir}/mpdbot/ \
{envsitepackagesdir}/pi/ \
{envsitepackagesdir}/races/ \
{envsitepackagesdir}/seen/ \
{envsitepackagesdir}/storycraft/ \
{envsitepackagesdir}/transform/ \
{envsitepackagesdir}/twitter/ \
{envsitepackagesdir}/weather/ \
-r
[testenv:lint]
# run style checks
commands =
flake8
- flake8 --disable-noqa --ignore= --select=E,W,F,C,D,A,G,B,I,T,M,DUO
[testenv:bundle]
# take extra actions (build sdist, sphinx, whatever) to completely package the app
commands =
cp -r {distdir} .
python setup.py sdist
[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}/gitlab_bot/
{envsitepackagesdir}/ircbot/
{envsitepackagesdir}/karma/
{envsitepackagesdir}/markov/
{envsitepackagesdir}/mpdbot/
{envsitepackagesdir}/pi/
{envsitepackagesdir}/races/
{envsitepackagesdir}/seen/
{envsitepackagesdir}/storycraft/
{envsitepackagesdir}/transform/
{envsitepackagesdir}/twitter/
{envsitepackagesdir}/weather/
omit =
**/_version.py
[flake8]
enable-extensions = G,M
exclude =
.tox/
versioneer.py
_version.py
instance/
extend-ignore = T101
max-complexity = 10
max-line-length = 120
[isort]
line_length = 120
[pytest]
python_files =
*_tests.py
tests.py
test_*.py
DJANGO_SETTINGS_MODULE = dr_botzo.settings
django_find_project = false