forked from gluetool/gluetool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
73 lines (62 loc) · 3.05 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
[tox]
envlist = {py27,py36,py37,py38}-{static-analysis,unit-tests,codecov},type-check
[testenv]
# Tox should set correct Python version given the environment. let's trust it knows how.
#basepython =
# py27: python2.7
# py36: python3.6
# Use a single env directory for all environments but separate by Python versions.
#
# It could be easier to just say:
#
# envdir = {toxworkdir}/{basepython}
#
# but, since it's hardcoded in Tox, basepython is not set when envdir is being examined,
# therefore, the replacement fails, hence the explicit names.
envdir =
py27: {toxinidir}/.tox/py27
py36: {toxinidir}/.tox/py36
py37: {toxinidir}/.tox/py37
py38: {toxinidir}/.tox/py38
# Don't spoil our nice virtualenvs with system packages
sitepackages = False
# Just test dependencies - gluetool will pull in its own dependencies when being installed
deps = -rtest-requirements.txt
# Capture coverage per Python version
setenv = COVERAGE_FILE={envdir}/.coverage
# Pass necessary env vars to let CI and coverage gathering play together nicely
passenv = CI TRAVIS TRAVIS_* CODECOV_TOKEN
# Conditionals don't support multiline branches, therefore codecov upload is a separate step.
# but that's fine, thanks to options we give it it knows where to find coverage (specific for
# Python version), and we even tell it to add Python version as a flag - keeping coverage
# separate even in Codecov seems to be a good starting point, we can always start merging
# them later.
#
# And there's an advantage: the codecov upload does not run when one runs *-unit-tests env locally.
# It'd fail anyway, since one does not usually have CODECOV_TOKEN set, and it's still possible
# to run it explicitly to upload one's local coverage in case of need.
commands =
static-analysis: pytest -v -ra --pylint --flake8 -k 'not test_' {posargs}
unit-tests: pytest -v -ra --cov=gluetool --cov-report=html:{envdir}/coverage-report {posargs}
codecov: codecov --file={envdir}/.coverage --flags={basepython}
[testenv:type-check]
envdir = {toxinidir}/.tox/type-check
basepython = python3.6
skip_install = True
deps =
mypy==0.720
mypy-extensions==0.4.1
setenv =
MYPATH = {toxinidir}
# Adding `--no-warn-unused-ignores` - `HTTPConnection.debuglevel` is not publicly available in Python 3,
# but mypy does not let us use conditional ignore, therefore it complains about the ignore when being
# checked in `--py2` mode (because in Python 2, the attribute does exist & the ignore is pointless).
# I don't see a way out of it :/
commands = mypy --config-file {toxinidir}/mypy.ini --py2 --strict --no-warn-unused-ignores {toxinidir}/gluetool/ {posargs}
mypy --config-file {toxinidir}/mypy.ini --strict --no-warn-unused-ignores {toxinidir}/gluetool/ {posargs}
# [testenv:py27-doctest]
# whitelist_externals = ansible-playbook
# commands = /usr/bin/ansible-playbook generate-docs.yml -e generate_dir="{envtmpdir}/docs"
# [testenv:py27-static-analysis-coala]
# whitelist_externals = docker
# commands = docker run -ti --rm -v {toxinidir}:/gluetool:z --workdir=/gluetool coala/base coala -c /gluetool/.coafile --non-interactive