2020-06-16 22:59:23 -05:00
|
|
|
# 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]
|
2023-10-07 13:07:05 -05:00
|
|
|
envlist = begin,py38,py39,py310,py311,coverage,security,lint,bundle
|
2020-06-16 22:59:23 -05:00
|
|
|
|
|
|
|
[testenv]
|
|
|
|
# build a wheel and test it
|
|
|
|
wheel = true
|
|
|
|
wheel_build_env = build
|
|
|
|
|
|
|
|
# whitelist commands we need
|
2020-10-20 16:07:49 -05:00
|
|
|
whitelist_externals = cp
|
2020-06-16 22:59:23 -05:00
|
|
|
|
2020-06-23 13:33:15 -05:00
|
|
|
# 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
|
2020-06-22 18:16:43 -05:00
|
|
|
deps =
|
2020-06-23 13:33:15 -05:00
|
|
|
-rrequirements/requirements-dev.txt
|
2020-06-22 18:16:43 -05:00
|
|
|
|
2020-06-16 22:59:23 -05:00
|
|
|
[testenv:build]
|
|
|
|
# require setuptools when building
|
|
|
|
deps = setuptools
|
|
|
|
|
2020-10-20 16:07:49 -05:00
|
|
|
[testenv:begin]
|
|
|
|
# clean up potential previous coverage runs
|
|
|
|
skip_install = true
|
|
|
|
commands = coverage erase
|
|
|
|
|
2022-01-15 17:35:56 -06:00
|
|
|
[testenv:py38]
|
2020-06-22 18:16:43 -05:00
|
|
|
# run pytest with coverage
|
2020-06-16 22:59:23 -05:00
|
|
|
commands =
|
2020-10-20 16:07:49 -05:00
|
|
|
pytest --cov-append --cov={envsitepackagesdir}/incorporealcms/ --cov-branch
|
|
|
|
|
2022-01-15 17:35:56 -06:00
|
|
|
[testenv:py39]
|
2020-10-20 16:07:49 -05:00
|
|
|
# run pytest with coverage
|
|
|
|
commands =
|
|
|
|
pytest --cov-append --cov={envsitepackagesdir}/incorporealcms/ --cov-branch
|
|
|
|
|
2022-01-15 17:35:56 -06:00
|
|
|
[testenv:py310]
|
2021-06-24 11:23:36 -05:00
|
|
|
# run pytest with coverage
|
|
|
|
commands =
|
|
|
|
pytest --cov-append --cov={envsitepackagesdir}/incorporealcms/ --cov-branch
|
|
|
|
|
2023-10-07 13:07:05 -05:00
|
|
|
[testenv:py311]
|
|
|
|
# run pytest with coverage
|
|
|
|
commands =
|
|
|
|
pytest --cov-append --cov={envsitepackagesdir}/incorporealcms/ --cov-branch
|
|
|
|
|
2020-10-20 16:07:49 -05:00
|
|
|
[testenv:coverage]
|
|
|
|
# report on coverage runs from above
|
|
|
|
skip_install = true
|
|
|
|
commands =
|
|
|
|
coverage report --fail-under=95 --show-missing
|
2020-06-16 22:59:23 -05:00
|
|
|
|
2020-06-18 17:39:34 -05:00
|
|
|
[testenv:security]
|
|
|
|
# run security checks
|
|
|
|
#
|
|
|
|
# again it seems the most valuable here to run against the packaged code
|
2022-12-31 10:04:11 -06:00
|
|
|
# 51457 is nearly a red herring that I'm stuck with because tox is pinned, try removing occasionally
|
2020-06-18 17:39:34 -05:00
|
|
|
commands =
|
|
|
|
bandit {envsitepackagesdir}/incorporealcms/ -r
|
2022-12-31 10:04:11 -06:00
|
|
|
safety check -r requirements/requirements-dev.txt -i 51457
|
2020-06-18 17:39:34 -05:00
|
|
|
|
2020-06-17 20:18:43 -05:00
|
|
|
[testenv:lint]
|
|
|
|
# run style checks
|
|
|
|
commands =
|
|
|
|
flake8
|
2020-10-20 16:07:49 -05:00
|
|
|
- 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
|
2020-06-17 20:18:43 -05:00
|
|
|
|
2020-06-19 20:01:06 -05:00
|
|
|
[coverage:paths]
|
|
|
|
source =
|
|
|
|
./
|
|
|
|
.tox/**/site-packages/
|
|
|
|
|
|
|
|
[coverage:run]
|
|
|
|
branch = True
|
2020-06-23 13:33:15 -05:00
|
|
|
|
2020-06-19 20:01:06 -05:00
|
|
|
omit =
|
|
|
|
**/_version.py
|
|
|
|
|
2020-06-16 22:59:23 -05:00
|
|
|
[flake8]
|
2020-10-20 16:07:49 -05:00
|
|
|
enable-extensions = G,M
|
2020-06-17 20:18:43 -05:00
|
|
|
exclude =
|
|
|
|
.tox/
|
|
|
|
versioneer.py
|
|
|
|
_version.py
|
|
|
|
instance/
|
2023-10-07 13:07:05 -05:00
|
|
|
venv/
|
2020-06-23 13:33:15 -05:00
|
|
|
extend-ignore = T101
|
2020-06-17 20:18:43 -05:00
|
|
|
max-complexity = 10
|
2020-06-20 10:48:46 -05:00
|
|
|
max-line-length = 120
|
2020-06-16 22:59:23 -05:00
|
|
|
|
2020-06-19 20:23:23 -05:00
|
|
|
[isort]
|
|
|
|
line_length = 120
|
|
|
|
|
2020-06-16 22:59:23 -05:00
|
|
|
[pytest]
|
2020-06-18 23:36:51 -05:00
|
|
|
python_files =
|
|
|
|
*_tests.py
|
|
|
|
tests.py
|
|
|
|
test_*.py
|