Merge "Refactor: Update setup.cfg due to deprecations"
[releng/lftools.git] / tox.ini
1 [tox]
2 envlist =
3     docs,
4     docs-linkcheck,
5     license,
6     pre-commit,
7     py36,
8     py37,
9     py38
10 minversion = 3.7
11 skip_missing_interpreters = true
12 ignore_basepython_conflict = true
13
14 [flake8]
15 max-complexity = 22
16 max-line-length = 120
17 ignore = E203, W503, C901, E402, B011
18
19 [pep8]
20 max-line-length = 120
21
22 [pytest]
23 markers = datafiles
24 addopts = -p no:warnings
25
26 [testenv]
27 basepython = python3
28 deps = -r{toxinidir}/requirements-test.txt
29 commands = pytest
30 usedevelop = true
31
32 [testenv:docs]
33 description = Build the documentation with sphinx
34 basepython = python3
35 deps = -rrequirements-docs.txt
36 extras = openstack
37 commands = sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
38
39 [testenv:docs-linkcheck]
40 description = Check the documentation links with sphinx
41 basepython = python3
42 deps = -rrequirements-docs.txt
43 extras = openstack
44 commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
45
46 [testenv:latest-upstream]
47 description = Latest upstream test. Used for what exactly?
48 basepython = python3
49 deps = -r{toxinidir}/requirements-test.txt
50 commands =
51     pip install -U python-jenkins requests shade
52     pytest
53
54 [testenv:license]
55 description = Check all files for license header
56 basepython = python3
57 deps = lftools
58 commands =
59     lftools license check-dir lftools
60     lftools license check-dir -r '.+' shell
61
62 [testenv:pre-commit]
63 description = Precommit checks for black, gitlint, etc.
64 basepython = python3
65 allowlist_externals =
66     /bin/sh
67 deps =
68     pre-commit
69 passenv = HOME
70 commands =
71     pre-commit run --all-files --show-diff-on-failure
72     /bin/sh -c 'if ! git config --get user.name > /dev/null; then \
73         git config --global --add user.name "CI"; \
74         touch .git/REMOVE_USERNAME; fi'
75     /bin/sh -c 'if ! git config --get user.email > /dev/null; then \
76         git config --global --add user.email "ci@example.org"; \
77         touch .git/REMOVE_USEREMAIL; fi'
78     /bin/sh -c "if [ -f .git/COMMIT_EDITMSG ]; then \
79         cp .git/COMMIT_EDITMSG .git/COMMIT_MSGTOX; else \
80         git log HEAD -n1 --pretty=%B > .git/COMMIT_MSGTOX; fi"
81     pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_MSGTOX
82     /bin/sh -c "rm -f .git/COMMIT_MSGTOX"
83     /bin/sh -c "if [ -f .git/REMOVE_USERNAME ]; then \
84         git config --global --unset user.name; \
85         rm -f .git/REMOVE_USERNAME; fi"
86     /bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \
87         git config --global --unset user.email; \
88         rm -f .git/REMOVE_USEREMAIL; fi"
89
90 [testenv:reno]
91 description = OpenStack Reno checks
92 basepython = python3
93 deps = reno
94 commands = reno {posargs:--help}