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