forked from projecthamster/hamster-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
128 lines (109 loc) · 3.68 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# vim:tw=0:ts=2:sw=2:et:norl:ft=config
# - (lb): I'd prefer ft=config, but indented comments not highlighted properly.
# This file exists within 'dob':
#
# https://github.com/hotoffthehamster/dob
# This tox configuration is used when `tox` runs locally,
# as well as when Travis CI runs tox. See:
#
# https://travis-ci.org/hotoffthehamster/dob/
# Omit tasks:
# codecov -- for Travis CI, per .travis.yml.
# isort -- unrelated issues and will always fail.
# pydocstyle -- because docstrings so very broken (lb).
[tox]
envlist = py{38,37,36}, dist_check, docs, flake8, manifest
[testenv]
# The [testenv] section provides defaults to the other [testenv:TEST] sections.
# Below, we'll set basepython for each of the make-test tasks. Here, we
# specify the latest Python as the default for other tasks (flake8, etc.).
basepython = python3.8
# Run tests by default. The [testenv:py*] tasks will default to these commands.
# Other tasks (flake8, etc.) will override these values with their own commands.
commands_pre =
# (lb): I tried `if [ -f ... ]`` and ``test -f ... &&``, etc., but tox did not
# like any of them, so we use a make task, tox_commands_pre, to pip-install
# option local environment dependencies.
make tox_commands_pre
pip install -U -r requirements/test.pip
pip install -U -e .
whitelist_externals = make
commands = make test
# ***
[testenv:py38]
basepython = python3.8
[testenv:py37]
basepython = python3.7
[testenv:py36]
basepython = python3.6
# ***
[testenv:codecov]
deps = codecov
# Use passenv, lest:
# Error: Missing repository upload token
passenv = CODECOV_*
commands =
# Remove XML so codecov regenerates it.
/bin/rm -f coverage.xml
# Run tests and generate coverage.
py.test --cov=./dob tests/
# Upload coverage results to codecov.io.
codecov
[testenv:dist_check]
# (lb): TEACH: An alternative to commands_pre, e.g.,
# commands_pre = pip install -U -r requirements/release.pip
# is to use deps' -r option, thusly:
deps = -rrequirements/release.pip
commands_pre =
commands =
# Check distribution package (e.g., verify README will render in PyPI)
# [à la deprecated readme_renderer and `python setup.py check -m -r -s`].
python setup.py sdist
python setup.py bdist_wheel
twine check dist/*
[testenv:docs]
commands_pre = pip install -U -r requirements/docs.pip
deps =
doc8
# Avoid doc8 error: `D000 Cannot analyze code. Pygments package not found.`
pygments
commands =
# Build to a temporary directory, e.g., instead of calling simply
# make docs
# make it unnecessarily more complex,
# (lb) because I saw this code in another project and thought it looked cool.
# The make-docs here is called as, e.g.,
# make docs \
# BUILDDIR=/path/to/project/.tox/docs/tmp \
# SPHINXOPTS=
make docs \
BUILDDIR={envtmpdir} \
SPHINXOPTS={env:SPHINXOPTS_BUILD:''}
# The make-linkcheck is called as, e.g.,
# make --directory=docs linkcheck \
# BUILDDIR=/path/to/project/.tox/docs/tmp \
# SPHINXOPTS=
make --directory=docs linkcheck \
BUILDDIR={envtmpdir} \
SPHINXOPTS={env:SPHINXOPTS_LINKCHECK:}
# "Doc8 is an opinionated style checker for rst...."
doc8
[testenv:flake8]
commands_pre =
deps = flake8
commands = flake8 setup.py dob/ tests/
[testenv:isort]
commands_pre =
deps = isort
commands = isort --check-only --recursive --verbose setup.py dob/ tests/
[testenv:manifest]
commands_pre =
deps = check-manifest
commands =
check-manifest -v
# PEP 257 -- Docstring Conventions
# https://www.python.org/dev/peps/pep-0257/
[testenv:pydocstyle]
commands_pre =
deps = pydocstyle
commands = pydocstyle setup.py dob/ tests/