Skip to content

Commit d3ba5a4

Browse files
committed
Use tox, use codecov, work around pypy3 issues.
1 parent 65ef250 commit d3ba5a4

File tree

3 files changed

+213
-14
lines changed

3 files changed

+213
-14
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
*.pyc
33
html/
44
venv/
5-
.cache/
5+
.cache/
6+
.tox
7+
.coverage

.travis.yml

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,54 @@
11
language: python
2-
python:
3-
- 2.6
4-
- 2.7
5-
- 3.3
6-
- 3.4
7-
- 3.5
8-
- pypy
9-
- pypy3.3-5.2-alpha1
2+
matrix:
3+
include:
4+
- python: 2.6
5+
env: TOXENV=py26
6+
- python: 2.7
7+
env: TOXENV=py27
8+
- python: 3.3
9+
env: TOXENV=py33
10+
- python: 3.4
11+
env: TOXENV=py34
12+
- python: 3.5
13+
env: TOXENV=py35
14+
- python: 3.6
15+
env: TOXENV=py36
16+
- python: 3.7-dev
17+
env: TOXENV=py37
18+
- python: nightly
19+
env: TOXENV=py37
20+
- python: pypy
21+
env: TOXENV=pypy
22+
- python: pypy3
23+
env: TOXENV=pypy3
24+
- python: pypy3.3-5.2-alpha1
25+
env: TOXENV=pypy3
26+
- python: pypy3.3-5.5-alpha
27+
env: TOXENV=pypy3
28+
allow_failures:
29+
- python: pypy3
30+
- python: 3.7-dev
31+
- python: nightly
1032
install:
11-
- pip install --upgrade pytest
12-
- pip install --upgrade pytest-cov
13-
- pip install --upgrade coveralls
33+
- pip install --upgrade tox coveralls codecov
1434
script:
15-
- py.test --cov-report= --cov=ssh-audit -v test
35+
- if [ -z "${TOXENV##*py3*}" ]; then
36+
export MYPYBASE=python;
37+
if [ -z "${TOXENV##*pypy3*}" ]; then
38+
_pydir=$(dirname $(which python));
39+
ln -s -- "${_pydir}/python" "${_pydir}/pypy3";
40+
export TOXENV=${TOXENV},cov,lint;
41+
else
42+
export TOXENV=${TOXENV},cov,type,lint;
43+
fi
44+
else
45+
export MYPYBASE=python-unknown;
46+
export TOXENV=${TOXENV},cov,lint;
47+
fi
48+
- tox -e $TOXENV
1649
after_success:
1750
- coveralls
18-
51+
- codecov
52+
after_failure:
53+
- cat .tox/log/*
54+
- cat .tox/*/log/*

tox.ini

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
[tox]
2+
envlist = py26,py27,py33,py34,py35,py36,py37,jython,pypy,pypy3,cov,type,lint
3+
skipsdist = true
4+
skip_missing_interpreters = true
5+
6+
[testenv]
7+
deps =
8+
pytest==3.0.7
9+
coverage==4.3.4
10+
colorama==0.3.7
11+
setenv =
12+
SSHAUDIT = {toxinidir}/ssh-audit.py
13+
COVERAGE_FILE = {toxinidir}/.coverage.{envname}
14+
commands =
15+
coverage run --source ssh-audit -m -- pytest -v {posargs:test}
16+
coverage report --show-missing
17+
coverage html -d {toxinidir}/html/coverage.{envname}
18+
19+
[testenv:cov]
20+
deps =
21+
coverage==4.3.4
22+
setenv =
23+
COVERAGE_FILE = {toxinidir}/.coverage
24+
commands =
25+
coverage erase
26+
coverage combine
27+
coverage report --show-missing
28+
coverage html -d {toxinidir}/html/coverage
29+
ignore_outcome = true
30+
31+
[testenv:mypy]
32+
basepython =
33+
{env:MYPYBASE:python3.5}
34+
deps =
35+
colorama==0.3.7
36+
mypy==0.501
37+
lxml==3.7.3
38+
setenv =
39+
{[testenv]setenv}
40+
MYPYPATH = {toxinidir}/test/stubs
41+
MYPYHTML = {toxinidir}/html/mypy
42+
commands =
43+
mypy \
44+
--show-error-context \
45+
--config-file {toxinidir}/tox.ini \
46+
--html-report {env:MYPYHTML}.py3 \
47+
{posargs:{env:SSHAUDIT}}
48+
mypy \
49+
-2 \
50+
--no-warn-incomplete-stub \
51+
--show-error-context \
52+
--config-file {toxinidir}/tox.ini \
53+
--html-report {env:MYPYHTML}.py2 \
54+
{posargs:{env:SSHAUDIT}}
55+
56+
[testenv:pylint]
57+
deps =
58+
mccabe
59+
pylint
60+
commands =
61+
pylint \
62+
--rcfile tox.ini \
63+
--load-plugins=pylint.extensions.bad_builtin \
64+
--load-plugins=pylint.extensions.check_elif \
65+
--load-plugins=pylint.extensions.mccabe \
66+
{posargs:{env:SSHAUDIT}}
67+
68+
[testenv:flake8]
69+
deps =
70+
flake8
71+
commands =
72+
flake8 {posargs:{env:SSHAUDIT}}
73+
74+
[testenv:vulture]
75+
deps = vulture
76+
commands =
77+
python -c "import sys; from subprocess import Popen, PIPE; \
78+
a = ['vulture'] + r'{posargs:{env:SSHAUDIT}}'.split(' '); \
79+
o = Popen(a, shell=False, stdout=PIPE).communicate()[0]; \
80+
l = [x for x in o.split('\n') if x and 'Unused import' not in x]; \
81+
print('\n'.join(l)); \
82+
sys.exit(1 if len(l) > 0 else 0)"
83+
84+
[testenv:type]
85+
basepython =
86+
{[testenv:mypy]basepython}
87+
deps =
88+
{[testenv:mypy]deps}
89+
setenv =
90+
{[testenv:mypy]setenv}
91+
commands =
92+
{[testenv:mypy]commands}
93+
ignore_outcome = true
94+
95+
[testenv:lint]
96+
deps =
97+
{[testenv:pylint]deps}
98+
{[testenv:flake8]deps}
99+
{[testenv:vulture]deps}
100+
commands =
101+
{[testenv:pylint]commands}
102+
{[testenv:flake8]commands}
103+
{[testenv:vulture]commands}
104+
ignore_outcome = true
105+
106+
107+
[mypy]
108+
ignore_missing_imports = False
109+
follow_imports = error
110+
disallow_untyped_calls = True
111+
disallow_untyped_defs = True
112+
check_untyped_defs = True
113+
disallow_subclassing_any = True
114+
warn_incomplete_stub = True
115+
warn_redundant_casts = True
116+
warn_return_any = True
117+
warn_unused_ignores = True
118+
strict_optional = True
119+
#strict_boolean = False
120+
121+
[pylint]
122+
reports = no
123+
#output-format = colorized
124+
indent-string = \t
125+
disable = locally-disabled, bad-continuation, multiple-imports, invalid-name, trailing-whitespace, missing-docstring
126+
max-complexity = 15
127+
max-args = 8
128+
max-locals = 20
129+
max-returns = 6
130+
max-branches = 15
131+
max-statements = 60
132+
max-parents = 7
133+
max-attributes = 8
134+
min-public-methods = 1
135+
max-public-methods = 20
136+
max-bool-expr = 5
137+
max-nested-blocks = 6
138+
max-line-length = 80
139+
ignore-long-lines = ^\s*(#\s+type:\s+.*|[A-Z0-9_]+\s+=\s+.*|('.*':\s+)?\[.*\],?)$
140+
max-module-lines = 2500
141+
142+
[flake8]
143+
ignore =
144+
# indentation contains tabs
145+
W191,
146+
# blank line contains whitespace
147+
W293,
148+
# indentation contains mixed spaces and tabs
149+
E101,
150+
# multiple spaces before operator
151+
E221,
152+
# multiple spaces after operator
153+
E241,
154+
# multiple imports on one line
155+
E401,
156+
# line too long
157+
E501,
158+
# module imported but unused
159+
F401,
160+
# undefined name
161+
F821

0 commit comments

Comments
 (0)