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