Fix: Add missing Python module dependency "munch" causing cleanup job failures
[releng/lftools.git] / tox.ini
1 [tox]
2 envlist =
3     docs,
4     docs-linkcheck,
5     license,
6     pre-commit,
7     py38
8     py39
9 minversion = 3.8
10 skip_missing_interpreters = true
11 ignore_basepython_conflict = true
12
13 [pytest]
14 markers = datafiles
15 addopts =
16     -p no:warnings
17     --cov=lftools
18     --cov-report=term-missing
19
20 [testenv]
21 basepython = python3
22 # This needs to mirror the test section of pyproject.toml
23 deps =
24     pytest==5.3.5
25     pytest-click==0.3
26     pytest-cov
27     pytest-datafiles==2.0
28     pytest-mock==2.0.0
29     pytest-responses==0.4.0
30
31 commands = pytest
32 usedevelop = true
33
34
35 [testenv:{build,clean}]
36 description =
37     build: Build the package in isolation according to PEP517, see https://github.com/pypa/build
38     clean: Remove old distribution files and temporary build artifacts (./build and ./dist)
39 # https://setuptools.pypa.io/en/stable/build_meta.html#how-to-use-it
40 skip_install = True
41 changedir = {toxinidir}
42 deps =
43     build: build[virtualenv]
44 passenv =
45     SETUPTOOLS_*
46 commands =
47     clean: python -c 'import shutil; [shutil.rmtree(p, True) for p in ("build", "dist", "docs/_build")]'
48     clean: python -c 'import pathlib, shutil; [shutil.rmtree(p, True) for p in pathlib.Path("src").glob("*.egg-info")]'
49     build: python -m build {posargs}
50 # By default, both `sdist` and `wheel` are built. If your sdist is too big or you don't want
51 # to make it available, consider running: `tox -e build -- --wheel`
52
53
54 [testenv:docs]
55 description = Build the documentation with sphinx
56 basepython = python3.8
57 # This needs to mirror the docs section of pyproject.toml plus the testenv
58 deps =
59     {[testenv]deps}
60     lfdocs-conf
61     reno
62     sphinxcontrib-programoutput
63
64 extras = openstack
65 commands = sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
66
67 [testenv:docs-linkcheck]
68 description = Check the documentation links with sphinx
69 basepython = python3.8
70 deps =
71     {[testenv:docs]deps}
72 extras = openstack
73 commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
74
75 [testenv:latest-upstream]
76 description = Latest upstream test. Used for what exactly?
77 basepython = python3
78 deps =
79     {[testenv:docs]deps}
80 commands =
81     pip install -U python-jenkins requests
82     pytest
83
84 [testenv:license]
85 description = Check all files for license header
86 basepython = python3.8
87 deps = lftools
88 commands =
89     lftools license check-dir lftools
90     lftools license check-dir -r '.+' shell
91
92 [testenv:pre-commit]
93 description = Precommit checks for black, gitlint, etc.
94 basepython = python3.8
95 allowlist_externals =
96     /bin/sh
97 deps =
98     pre-commit
99 passenv = HOME
100 commands =
101     pre-commit run --all-files --show-diff-on-failure
102     /bin/sh -c 'if ! git config --get user.name > /dev/null; then \
103         git config --global --add user.name "CI"; \
104         touch .git/REMOVE_USERNAME; fi'
105     /bin/sh -c 'if ! git config --get user.email > /dev/null; then \
106         git config --global --add user.email "ci@example.org"; \
107         touch .git/REMOVE_USEREMAIL; fi'
108     /bin/sh -c "if [ -f .git/COMMIT_EDITMSG ]; then \
109         cp .git/COMMIT_EDITMSG .git/COMMIT_MSGTOX; else \
110         git log HEAD -n1 --pretty=%B > .git/COMMIT_MSGTOX; fi"
111     pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_MSGTOX
112     /bin/sh -c "rm -f .git/COMMIT_MSGTOX"
113     /bin/sh -c "if [ -f .git/REMOVE_USERNAME ]; then \
114         git config --global --unset user.name; \
115         rm -f .git/REMOVE_USERNAME; fi"
116     /bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \
117         git config --global --unset user.email; \
118         rm -f .git/REMOVE_USEREMAIL; fi"
119
120
121 [testenv:publish]
122 description =
123     Publish the package you have been developing to a package index server.
124     By default, it uses testpypi. If you really want to publish your package
125     to be publicly accessible in PyPI, use the `-- --repository pypi` option.
126 skip_install = True
127 changedir = {toxinidir}
128 passenv =
129     # See: https://twine.readthedocs.io/en/latest/
130     TWINE_USERNAME
131     TWINE_PASSWORD
132     TWINE_REPOSITORY
133     TWINE_REPOSITORY_URL
134 deps = twine
135 commands =
136     python -m twine check dist/*
137     python -m twine upload {posargs:--repository {env:TWINE_REPOSITORY:testpypi}} dist/*
138
139
140 [testenv:reno]
141 description = OpenStack Reno checks
142 basepython = python3
143 deps = reno
144 commands = reno {posargs:--help}