Force UTF-8 mode for testing
[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._vendor.pyparsing.core and pkg_resources._vendor.pyparsing raise
20 #   DeprecationWarning "module 'sre_constants' is deprecated" until a new
21 #   release containing https://github.com/pyparsing/pyparsing/commit/3c03942 is
22 #   vendored into pip and pkg_resources
23 # py310... distutils.command.install raises DeprecationWarning "The
24 #   distutils.sysconfig module is deprecated, use sysconfig instead" but this
25 #   can't be matched by message because it contains a comma
26 # flake8... flake8.plugins.manager raises DeprecationWarning "SelectableGroups
27 #   dict interface is deprecated. Use select."
28 # multiple callers raise DeprecationWarning "The distutils package is
29 #   deprecated and slated for removal in Python 3.12. Use setuptools or check
30 #   PEP 632 for potential alternatives"
31 # multiple callers raise DeprecationWarning "Creating a LegacyVersion has been
32 #   deprecated and will be removed in the next major release"
33 # SetupTools raises
34 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning "setup.py
35 #   install is deprecated. Use build and pip and other standards-based tools."
36 #   but only the message can be matched because the exception is private
37 # SetupTools raises
38 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning
39 #   "setup_requires is deprecated. Supply build dependencies using PEP 517
40 #   pyproject.toml build-requires." but only the message can be matched because
41 #   the exception is private
42 # SetupTools raises
43 #   setuptools._deprecation_warning.SetuptoolsDeprecationWarning "easy_install
44 #   command 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 # 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::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:module 'sre_constants' is deprecated:DeprecationWarning:pip._vendor.pyparsing.core, ignore:module 'sre_constants' is deprecated:DeprecationWarning:pkg_resources._vendor.pyparsing
54     PYTHONUTF8 = 1
55     VIRTUALENV_CREATOR = venv
56 commands = mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
57 deps = {toxinidir}
58
59 [testenv:bandit]
60 description = check for potential security risks in source code
61 deps = bandit
62 commands = bandit -r mudpy -x mudpy/tests {posargs}
63
64 [testenv:codespell]
65 description = find common spelling mistakes in code and documentation
66 deps = codespell
67 commands = codespell {posargs}
68
69 [testenv:demo]
70 description = start an interactive demo with the sample config
71 commands = mudpy {posargs}
72
73 [testenv:dist]
74 description = build release artifacts and check for conformance
75 allowlist_externals = rm
76 deps =
77     build
78     twine
79 commands =
80     rm -fr {toxinidir}/dist
81     python -m build
82     twine check --strict {toxinidir}/dist/*
83
84 [testenv:docs]
85 # Build an sdist into a temporary location so we'll have AUTHORS and ChangeLog
86 # files to include.
87 description = generate hypertext documentation
88 allowlist_externals = rm
89 deps =
90     {toxinidir}
91     build
92     sphinx
93 commands =
94     rm -fr {toxinidir}/doc/build
95     python -m build --outdir={toxinidir}/doc/build/dist --sdist
96     sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html
97
98 [testenv:flake8]
99 description = style checks and static analysis of source code
100 deps =
101     flake8
102     flake8-bugbear
103 commands = flake8 {posargs}
104
105 [testenv:selftest_config]
106 description = run the selftest with the included sample config
107 commands = mudpy_selftest etc/mudpy.yaml
108
109 [testenv:yamllint]
110 # Run the selftest before checking YAML files so we'll be sure to also catch at
111 # least some which are generated by the application, making sure it creates
112 # them with the same style we enforce for those carried in the repository.
113 description = test data files for correct syntax and formatting
114 deps =
115     {toxinidir}
116     yamllint
117 commands =
118     mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
119     yamllint --strict {posargs} .
120
121 [flake8]
122 show-source = True
123 exclude = .git, .tox, *lib/python*, *egg, build