Make dist checking directory-agnostic
[mudpy.git] / tox.ini
1 # Copyright (c) 2016-2021 mudpy authors. Permission to use, copy,
2 # modify, and distribute this software is granted under terms
3 # provided in the LICENSE file distributed with this software.
4
5 [tox]
6 minversion = 3.18
7 envlist = bandit, codespell, dist, docs, flake8, yamllint, selftest_config, py3
8 skipsdist = True
9 ignore_basepython_conflict = True
10
11 [testenv]
12 description = run the functional selftest with optimized configuration
13 basepython = python3
14 usedevelop = True
15 # TODO(fungi) Switch this to "error" once the following are solved
16 #
17 # py310... importlib._bootstrap raises ImportWarning:
18 #   _SixMetaPathImporter.find_spec() not found; falling back to find_module()
19 # all... pip._vendor.packaging.version raises DeprecationWarning: Creating a
20 #   LegacyVersion has been deprecated and will be removed in the next major
21 #   release
22 # yamllint... pip._vendor.packaging.specifiers raises DeprecationWarning:
23 #   Creating a LegacyVersion has been deprecated and will be removed in the
24 #   next major release
25 # py310... pip._vendor.packaging.tags and setuptools both raise
26 #   DeprecationWarning: The distutils package is deprecated and slated for
27 #   removal in Python 3.12. Use setuptools or check PEP 632 for potential
28 #   alternatives
29 setenv =
30     PYTHONWARNINGS = error, ignore:::importlib._bootstrap, ignore:::pip._vendor.packaging.version, ignore:::pip._vendor.packaging.specifiers, ignore:::pip._vendor.packaging.tags, ignore:::setuptools
31     VIRTUALENV_CREATOR = venv
32 commands = mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
33
34 [testenv:bandit]
35 description = check for potential security risks in source code
36 deps = bandit
37 commands = bandit -r mudpy -x mudpy/tests {posargs}
38 usedevelop = False
39
40 [testenv:codespell]
41 description = find common spelling mistakes in code and documentation
42 deps = codespell
43 commands = codespell {posargs}
44 usedevelop = False
45
46 [testenv:demo]
47 description = start an interactive demo with the sample config
48 commands = mudpy {posargs}
49
50 [testenv:dist]
51 description = build release artifacts and check for conformance
52 allowlist_externals = rm
53 deps =
54     pbr
55     twine
56     wheel
57 commands =
58     rm -fr {toxinidir}/dist
59     python setup.py bdist_wheel sdist
60     twine check --strict {toxinidir}/dist/*
61 usedevelop = False
62
63 [testenv:docs]
64 description = generate hypertext documentation
65 allowlist_externals = rm
66 deps =
67     -r{toxinidir}/requirements.txt
68     -r{toxinidir}/doc/requirements.txt
69 commands =
70     rm -fr doc/build
71     python setup.py sdist
72     sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html
73 usedevelop = False
74
75 [testenv:flake8]
76 description = style checks and static analysis of source code
77 deps =
78     flake8
79     flake8-bugbear
80 commands = flake8 {posargs}
81 usedevelop = False
82
83 [testenv:selftest_config]
84 description = run the selftest with the included sample config
85 commands = mudpy_selftest etc/mudpy.yaml
86
87 [testenv:yamllint]
88 description = test data files for correct syntax and formatting
89 deps = yamllint
90 commands =
91     mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
92     yamllint --strict {posargs} .
93
94 [flake8]
95 show-source = True
96 exclude = .git, .tox, *lib/python*, *egg, build