1e90c1a33176744f67c1078f7c05a14cae3b3f0d
[mudpy.git] / tox.ini
1 # Copyright (c) 2016-2022 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 # TODO(fungi) Switch this to "error" once the following are solved
15 #
16 # py311... passlib.utils raises DeprecationWarning "'crypt' is deprecated and
17 #   slated for removal in Python 3.13"
18 # py311... mudpy.tests.selftest raises DeprecationWarning "'telnetlib' is
19 #   deprecated and slated for removal in Python 3.13"
20 # yamllint... setuptools.command.build_py raises
21 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning "Installing
22 #   'yamllint.conf' as data is deprecated, please list it in `packages`. [...]"
23 #   but the message can't be matched because it contains a comma and spans
24 #   multiple lines while the custom Warning subclass can't be matched
25 #   specifically leading to a blanket ignore for all Warning types in package
26 #   builds
27 # multiple callers raise DeprecationWarning "Creating a LegacyVersion has been
28 #   deprecated and will be removed in the next major release"
29 # SetupTools raises
30 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning "setup.py
31 #   install is deprecated. Use build and pip and other standards-based tools."
32 #   but only the message can be matched because the exception is private
33 # SetupTools raises
34 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning
35 #   "setup_requires is deprecated. Supply build dependencies using PEP 517
36 #   pyproject.toml build-requires." but only the message can be matched because
37 #   the exception is private
38 # SetupTools raises
39 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning "easy_install
40 #   command is deprecated. Use build and pip and other standards-based tools."
41 #   but only the message can be matched because the exception is private
42 # setuptools.config.pyprojecttoml raises
43 #   setuptools.config.pyprojecttoml._ExperimentalProjectMetadata "Support for
44 #   `[tool.setuptools]` in `pyproject.toml` is still *beta*." but the parent
45 #   Warning class has to be used instead
46 # pip._vendor.certifi.core and pip._vendor.pep517.in_process raise
47 #   DeprecationWarning "path is deprecated. Use files() instead. Refer to
48 #   https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy
49 #   for migration advice." but this can't be matched by message because it
50 #   contains a colon
51 setenv =
52     PYTHONWARNDFAULTENCODING = 1
53     PYTHONWARNINGS = error, ignore:Creating a LegacyVersion has been deprecated and will be removed in the next major release:DeprecationWarning, ignore:setup.py install is deprecated. Use build and pip and other standards-based tools., ignore:easy_install command is deprecated. Use build and pip and other standards-based tools., ignore::DeprecationWarning:pip._vendor.certifi.core, ignore::DeprecationWarning:pip._vendor.pep517.in_process, ignore:'crypt' is deprecated and slated for removal in Python 3.13:DeprecationWarning:passlib.utils, ignore:'telnetlib' is deprecated and slated for removal in Python 3.13:DeprecationWarning:mudpy.tests.selftest, ignore::Warning:setuptools.command.build_py, ignore:Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.:Warning:setuptools.config.pyprojecttoml
54     PYTHONUTF8 = 1
55     VIRTUALENV_CREATOR = venv
56 commands = mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
57 download = true
58 deps = {toxinidir}
59
60 [testenv:bandit]
61 description = check for potential security risks in source code
62 skip_install = True
63 deps = bandit
64 commands = bandit -r mudpy -x mudpy/tests {posargs}
65
66 [testenv:codespell]
67 description = find common spelling mistakes in code and documentation
68 skip_install = True
69 deps = codespell
70 commands = codespell {posargs}
71
72 [testenv:demo]
73 description = start an interactive demo with the sample config
74 commands = mudpy {posargs}
75
76 [testenv:dist]
77 description = build release artifacts and check for conformance
78 skip_install = True
79 deps =
80     build
81     twine
82 commands =
83     {envpython} -c "import shutil; shutil.rmtree('{toxinidir}/dist', ignore_errors=True)"
84     {envpython} -m build
85     twine check --strict {toxinidir}/dist/*
86
87 [testenv:docs]
88 # Build an sdist into a temporary location so we'll have AUTHORS and ChangeLog
89 # files to include.
90 description = generate hypertext documentation
91 deps =
92     {[testenv]deps}
93     build
94     sphinx
95 commands =
96     {envpython} -c "import shutil; shutil.rmtree('{toxinidir}/doc/build', ignore_errors=True)"
97     {envpython} -m build --outdir={toxinidir}/doc/build/dist --sdist
98     sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html
99
100 [testenv:flake8]
101 description = style checks and static analysis of source code
102 skip_install = True
103 deps = flake8-bugbear
104 commands = flake8 {posargs}
105
106 [testenv:selftest_config]
107 description = run the selftest with the included sample config
108 commands = mudpy_selftest etc/mudpy.yaml
109
110 [testenv:yamllint]
111 # Run the selftest before checking YAML files so we'll be sure to also catch at
112 # least some which are generated by the application, making sure it creates
113 # them with the same style we enforce for those carried in the repository.
114 description = test data files for correct syntax and formatting
115 deps =
116     {[testenv]deps}
117     yamllint
118 commands =
119     mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
120     yamllint --strict {posargs} .
121
122 [flake8]
123 show-source = True
124 exclude = .git, .tox, *lib/python*, *egg, build