mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-12-22 09:05:10 +01:00
Refactor tox.ini to be more versatile.
This commit is contained in:
parent
29d9e4270d
commit
6d9f5e6f2a
11
.travis.yml
11
.travis.yml
@ -1,4 +1,5 @@
|
||||
language: python
|
||||
sudo: false
|
||||
matrix:
|
||||
include:
|
||||
- python: 2.6
|
||||
@ -33,19 +34,17 @@ install:
|
||||
- pip install --upgrade tox coveralls codecov
|
||||
script:
|
||||
- if [ -z "${TOXENV##*py3*}" ]; then
|
||||
export MYPYBASE=python;
|
||||
if [ -z "${TOXENV##*pypy3*}" ]; then
|
||||
_pydir=$(dirname $(which python));
|
||||
ln -s -- "${_pydir}/python" "${_pydir}/pypy3";
|
||||
export TOXENV=${TOXENV},cov,lint;
|
||||
export TOXENV=${TOXENV}-test,${TOXENV}-lint;
|
||||
else
|
||||
export TOXENV=${TOXENV},cov,type,lint;
|
||||
export TOXENV=${TOXENV}-test,${TOXENV}-type,${TOXENV}-lint;
|
||||
fi
|
||||
else
|
||||
export MYPYBASE=python-unknown;
|
||||
export TOXENV=${TOXENV},cov,lint;
|
||||
export TOXENV=${TOXENV}-test,${TOXENV}-lint;
|
||||
fi
|
||||
- tox -e $TOXENV
|
||||
- tox -e $TOXENV,cov
|
||||
after_success:
|
||||
- coveralls
|
||||
- codecov
|
||||
|
70
tox.ini
70
tox.ini
@ -1,20 +1,36 @@
|
||||
[tox]
|
||||
envlist = py26,py27,py33,py34,py35,py36,py37,jython,pypy,pypy3,cov,type,lint
|
||||
envlist =
|
||||
py{26,27,py,py3}-{test,pylint,flake8,vulture}
|
||||
py{33,34,35,36,37}-{test,mypy,pylint,flake8,vulture}
|
||||
cov
|
||||
skipsdist = true
|
||||
skip_missing_interpreters = true
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
pytest==3.0.7
|
||||
coverage==4.3.4
|
||||
colorama==0.3.7
|
||||
test: pytest==3.0.7
|
||||
test,cov: {[testenv:cov]deps}
|
||||
test,py{33,34,35,36,37}-{type,mypy}: colorama==0.3.7
|
||||
py{33,34,35,36,37}-{type,mypy}: {[testenv:mypy]deps}
|
||||
lint,pylint: {[testenv:pylint]deps}
|
||||
lint,flake8: {[testenv:flake8]deps}
|
||||
lint,vulture: {[testenv:vulture]deps}
|
||||
setenv =
|
||||
SSHAUDIT = {toxinidir}/ssh-audit.py
|
||||
COVERAGE_FILE = {toxinidir}/.coverage.{envname}
|
||||
test: COVERAGE_FILE = {toxinidir}/.coverage.{envname}
|
||||
type,mypy: MYPYPATH = {toxinidir}/test/stubs
|
||||
type,mypy: MYPYHTML = {toxinidir}/html/mypy
|
||||
commands =
|
||||
coverage run --source ssh-audit -m -- pytest -v {posargs:test}
|
||||
coverage report --show-missing
|
||||
coverage html -d {toxinidir}/html/coverage.{envname}
|
||||
test: coverage run --source ssh-audit -m -- pytest -v {posargs:test}
|
||||
test: coverage report --show-missing
|
||||
test: - coverage html -d {toxinidir}/html/coverage.{envname}
|
||||
py{33,34,35,36,37}-{type,mypy}: {[testenv:mypy]commands}
|
||||
lint,pylint: {[testenv:pylint]commands}
|
||||
lint,flake8: {[testenv:flake8]commands}
|
||||
lint,vulture: {[testenv:vulture]commands}
|
||||
ignore_outcome =
|
||||
type: true
|
||||
lint: true
|
||||
|
||||
[testenv:cov]
|
||||
deps =
|
||||
@ -25,32 +41,25 @@ commands =
|
||||
coverage erase
|
||||
coverage combine
|
||||
coverage report --show-missing
|
||||
coverage html -d {toxinidir}/html/coverage
|
||||
ignore_outcome = true
|
||||
- coverage html -d {toxinidir}/html/coverage
|
||||
|
||||
[testenv:mypy]
|
||||
basepython =
|
||||
{env:MYPYBASE:python3.5}
|
||||
deps =
|
||||
colorama==0.3.7
|
||||
mypy==0.501
|
||||
lxml==3.7.3
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
MYPYPATH = {toxinidir}/test/stubs
|
||||
MYPYHTML = {toxinidir}/html/mypy
|
||||
commands =
|
||||
mypy \
|
||||
--show-error-context \
|
||||
--config-file {toxinidir}/tox.ini \
|
||||
--html-report {env:MYPYHTML}.py3 \
|
||||
--html-report {env:MYPYHTML}.py3.{envname} \
|
||||
{posargs:{env:SSHAUDIT}}
|
||||
mypy \
|
||||
-2 \
|
||||
--no-warn-incomplete-stub \
|
||||
--show-error-context \
|
||||
--config-file {toxinidir}/tox.ini \
|
||||
--html-report {env:MYPYHTML}.py2 \
|
||||
--html-report {env:MYPYHTML}.py2.{envname} \
|
||||
{posargs:{env:SSHAUDIT}}
|
||||
|
||||
[testenv:pylint]
|
||||
@ -72,7 +81,8 @@ commands =
|
||||
flake8 {posargs:{env:SSHAUDIT}}
|
||||
|
||||
[testenv:vulture]
|
||||
deps = vulture
|
||||
deps =
|
||||
vulture
|
||||
commands =
|
||||
python -c "import sys; from subprocess import Popen, PIPE; \
|
||||
a = ['vulture'] + r'{posargs:{env:SSHAUDIT}}'.split(' '); \
|
||||
@ -81,28 +91,6 @@ commands =
|
||||
print(b'\n'.join(l).decode('utf-8')); \
|
||||
sys.exit(1 if len(l) > 0 else 0)"
|
||||
|
||||
[testenv:type]
|
||||
basepython =
|
||||
{[testenv:mypy]basepython}
|
||||
deps =
|
||||
{[testenv:mypy]deps}
|
||||
setenv =
|
||||
{[testenv:mypy]setenv}
|
||||
commands =
|
||||
{[testenv:mypy]commands}
|
||||
ignore_outcome = true
|
||||
|
||||
[testenv:lint]
|
||||
deps =
|
||||
{[testenv:pylint]deps}
|
||||
{[testenv:flake8]deps}
|
||||
{[testenv:vulture]deps}
|
||||
commands =
|
||||
{[testenv:pylint]commands}
|
||||
{[testenv:flake8]commands}
|
||||
{[testenv:vulture]commands}
|
||||
ignore_outcome = true
|
||||
|
||||
|
||||
[mypy]
|
||||
ignore_missing_imports = False
|
||||
|
Loading…
Reference in New Issue
Block a user