Add preliminary support for Python 3.11
[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 # py311... Cython.Compiler.Main raises FutureWarning "Cython directive
18 #   'language_level' not set, using 2 for now (Py2). This will change in a
19 #   later release!" but this can't be matched by message because it has a comma
20 # py310... distutils.command.install raises DeprecationWarning "The
21 #   distutils.sysconfig module is deprecated, use sysconfig instead" but this
22 #   can't be matched by message because it contains a comma
23 # flake8... flake8.plugins.manager raises DeprecationWarning "SelectableGroups dict interface is deprecated. Use select."
24 # multiple callers raise DeprecationWarning "The distutils package is
25 #   deprecated and slated for removal in Python 3.12. Use setuptools or check
26 #   PEP 632 for potential alternatives"
27 # multiple callers raise DeprecationWarning "Creating a LegacyVersion has been
28 #   deprecated and will be removed in the next major release"
29 setenv =
30     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
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     build
55     twine
56 commands =
57     rm -fr {toxinidir}/dist
58     python -m build
59     twine check --strict {toxinidir}/dist/*
60 usedevelop = False
61
62 [testenv:docs]
63 # Build an sdist into a temporary location so we'll have AUTHORS and ChangeLog
64 # files to include. Keep usedevelop on so that the project dependencies will be
65 # installed in the venv.
66 description = generate hypertext documentation
67 allowlist_externals = rm
68 deps =
69     build
70     sphinx
71 commands =
72     rm -fr {toxinidir}/doc/build
73     python -m build --outdir={toxinidir}/doc/build/dist --sdist
74     sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html
75
76 [testenv:flake8]
77 description = style checks and static analysis of source code
78 deps =
79     flake8
80     flake8-bugbear
81 commands = flake8 {posargs}
82 usedevelop = False
83
84 [testenv:selftest_config]
85 description = run the selftest with the included sample config
86 commands = mudpy_selftest etc/mudpy.yaml
87
88 [testenv:yamllint]
89 # Run the selftest before checking YAML files so we'll be sure to also catch at
90 # least some which are generated by the application, making sure it creates
91 # them with the same style we enforce for those carried in the repository.
92 description = test data files for correct syntax and formatting
93 deps = yamllint
94 commands =
95     mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
96     yamllint --strict {posargs} .
97
98 [flake8]
99 show-source = True
100 exclude = .git, .tox, *lib/python*, *egg, build