-
Notifications
You must be signed in to change notification settings - Fork 8
/
tox.ini
146 lines (130 loc) · 4.23 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
[tox]
envlist =
docs,
docs-linkcheck,
license,
pre-commit,
py38
py39
minversion = 3.8
skip_missing_interpreters = true
ignore_basepython_conflict = true
[pytest]
markers = datafiles
addopts =
-p no:warnings
--cov=lftools
--cov-report=term-missing
[testenv]
basepython = python3
# This needs to mirror the test section of pyproject.toml
deps =
pytest==5.3.5
pytest-click==0.3
pytest-cov
pytest-datafiles==2.0
pytest-mock==2.0.0
pytest-responses==0.4.0
commands = pytest
usedevelop = true
[testenv:{build,clean}]
description =
build: Build the package in isolation according to PEP517, see https://github.com/pypa/build
clean: Remove old distribution files and temporary build artifacts (./build and ./dist)
# https://setuptools.pypa.io/en/stable/build_meta.html#how-to-use-it
skip_install = True
changedir = {toxinidir}
deps =
build: build[virtualenv]
passenv =
SETUPTOOLS_*
commands =
clean: python -c 'import shutil; [shutil.rmtree(p, True) for p in ("build", "dist", "docs/_build")]'
clean: python -c 'import pathlib, shutil; [shutil.rmtree(p, True) for p in pathlib.Path("src").glob("*.egg-info")]'
build: python -m build {posargs}
# By default, both `sdist` and `wheel` are built. If your sdist is too big or you don't want
# to make it available, consider running: `tox -e build -- --wheel`
[testenv:docs]
description = Build the documentation with sphinx
basepython = python3.8
# This needs to mirror the docs section of pyproject.toml plus the testenv
deps =
{[testenv]deps}
lfdocs-conf
reno
sphinxcontrib-programoutput
extras = openstack
commands = sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
[testenv:docs-linkcheck]
description = Check the documentation links with sphinx
basepython = python3.8
deps =
{[testenv:docs]deps}
extras = openstack
commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
[testenv:latest-upstream]
description = Latest upstream test. Used for what exactly?
basepython = python3
deps =
{[testenv:docs]deps}
commands =
pip install -U python-jenkins requests
pytest
[testenv:license]
description = Check all files for license header
basepython = python3.8
deps =
setuptools
lftools
commands =
lftools license check-dir lftools
lftools license check-dir -r '.+' shell
[testenv:pre-commit]
description = Precommit checks for black, gitlint, etc.
basepython = python3.8
allowlist_externals =
/bin/sh
deps =
pre-commit
passenv = HOME
commands =
pre-commit run --all-files --show-diff-on-failure
/bin/sh -c 'if ! git config --get user.name > /dev/null; then \
git config --global --add user.name "CI"; \
touch .git/REMOVE_USERNAME; fi'
/bin/sh -c 'if ! git config --get user.email > /dev/null; then \
git config --global --add user.email "[email protected]"; \
touch .git/REMOVE_USEREMAIL; fi'
/bin/sh -c "if [ -f .git/COMMIT_EDITMSG ]; then \
cp .git/COMMIT_EDITMSG .git/COMMIT_MSGTOX; else \
git log HEAD -n1 --pretty=%B > .git/COMMIT_MSGTOX; fi"
pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_MSGTOX
/bin/sh -c "rm -f .git/COMMIT_MSGTOX"
/bin/sh -c "if [ -f .git/REMOVE_USERNAME ]; then \
git config --global --unset user.name; \
rm -f .git/REMOVE_USERNAME; fi"
/bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \
git config --global --unset user.email; \
rm -f .git/REMOVE_USEREMAIL; fi"
[testenv:publish]
description =
Publish the package you have been developing to a package index server.
By default, it uses testpypi. If you really want to publish your package
to be publicly accessible in PyPI, use the `-- --repository pypi` option.
skip_install = True
changedir = {toxinidir}
passenv =
# See: https://twine.readthedocs.io/en/latest/
TWINE_USERNAME
TWINE_PASSWORD
TWINE_REPOSITORY
TWINE_REPOSITORY_URL
deps = twine
commands =
python -m twine check dist/*
python -m twine upload {posargs:--repository {env:TWINE_REPOSITORY:testpypi}} dist/*
[testenv:reno]
description = OpenStack Reno checks
basepython = python3
deps = reno
commands = reno {posargs:--help}