tox-poetry-installer/tox.ini

81 lines
3.0 KiB
INI
Raw Normal View History

2020-09-23 06:17:30 +00:00
[tox]
envlist = py36, py37, py38, static, static-tests, security
2020-09-23 06:17:30 +00:00
isolated_build = true
[testenv]
description = Run the tests
require_locked_deps = true
locked_deps =
pytest
pytest-cov
toml
2020-09-23 06:17:30 +00:00
commands =
pytest --cov {envsitepackagesdir}/tox_poetry_installer --cov-config {toxinidir}/.coveragerc --cov-report term-missing tests/
[testenv:static]
description = Static formatting and quality enforcement
basepython = python3.8
platform = linux
ignore_errors = true
require_locked_deps = true
locked_deps =
pylint
mypy
black
reorder-python-imports
pre-commit
allowlist_externals =
bash
commands =
black {toxinidir}/tox_poetry_installer/
# Oh man this is a doozy. If submodules are ever added to this plugin this will break, but I'm
# frustrated enough at this point that I'll need to take another look at it later to fix that.
# reorder-python-imports doesn't support handling directories on the CLI
# (https://github.com/asottile/reorder_python_imports/pull/76) and because the command is
# invoked directly (see comment below) we need file globbing to work around it.
# The "--unclassifiable-application-module" is a work around for reorder-python-imports not
# properly detecting the top-level module when run in a bash-wrapped command like this.
bash -c "reorder-python-imports {toxinidir}/tox_poetry_installer/*.py --unclassifiable-application-module tox_poetry_installer"
pre-commit run --all-files
pylint --rcfile {toxinidir}/.pylintrc {toxinidir}/tox_poetry_installer/
mypy --ignore-missing-imports --no-strict-optional {toxinidir}/tox_poetry_installer/
[testenv:static-tests]
description = Static formatting and quality enforcement for the tests
basepython = python3.8
platform = linux
ingore_errors = true
require_locked_deps = true
locked_deps =
pylint
mypy
black
reorder-python-imports
allowlist_externals =
bash
commands =
black {toxinidir}/tests/
# These bash-wrapped commands hurt my face, but these tools expect directories to be valid
# python modules, which the "tests/" directory is not. Since tox calls all commands directly
# (which is good) file globbing doesn't work. To make file globbing work they need to be wrapped
# in a bash call (which is bad).
bash -c "reorder-python-imports {toxinidir}/tests/*.py --unclassifiable-application-module tox_poetry_installer"
bash -c "pylint --rcfile {toxinidir}/.pylintrc {toxinidir}/tests/*.py"
bash -c "mypy --ignore-missing-imports --no-strict-optional {toxinidir}/tests/*.py"
[testenv:security]
description = Security checks
basepython = python3.8
platform = linux
ingore_errors = true
require_locked_deps = true
locked_deps =
bandit
safety
poetry
commands =
bandit --recursive --quiet {toxinidir}/tox_poetry_installer/
bandit --recursive --quiet --skip B101 {toxinidir}/tests/
poetry export --format requirements.txt --output {envtmpdir}/requirements.txt --without-hashes --dev
safety check --bare --file {envtmpdir}/requirements.txt