22516f5d5566aa60c66e53fd27b3d4366fa01f7e
[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 # py310... Cython.Compiler.Main raises FutureWarning "Cython directive
18 #  'language_level' not set, using 2 for now (Py2). This will change in a later
19 #  release!" but this can't be matched by message because it contains 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 # py310... importlib._bootstrap raises ImportWarning
24 #   "_SixMetaPathImporter.find_spec() not found; falling back to find_module()"
25 #   but this can't be matched by message for unknown reasons
26 # py310... pip._vendor.urllib3.connection and pip._vendor.urllib3.util.ssl_
27 #   both raise DeprecationWarning "ssl module: PROTOCOL_TLS is deprecated" but
28 #   this can't be matched by message because it contains a colon
29 # py310... wheel.bdist_wheel raises DeprecationWarning "The \"license_file\"
30 #   option is deprecated. Use \"license_files\" instead."
31 # multiple callers raise DeprecationWarning "The distutils package is
32 #   deprecated and slated for removal in Python 3.12. Use setuptools or check
33 #   PEP 632 for potential alternatives"
34 # multiple callers raise DeprecationWarning "Creating a LegacyVersion has been
35 #   deprecated and will be removed in the next major release"
36 setenv =
37     PYTHONWARNINGS = error, ignore::FutureWarning:Cython.Compiler.Main, ignore::DeprecationWarning:setuptools.config, ignore::DeprecationWarning:distutils.command.install, ignore::ImportWarning:importlib._bootstrap, ignore::DeprecationWarning:pip._vendor.urllib3.connection, ignore::DeprecationWarning:pip._vendor.urllib3.util.ssl_, ignore:The "license_file" option is deprecated. Use "license_files" instead.:DeprecationWarning:wheel.bdist_wheel, 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
38     VIRTUALENV_CREATOR = venv
39 commands = mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
40
41 [testenv:bandit]
42 description = check for potential security risks in source code
43 deps = bandit
44 commands = bandit -r mudpy -x mudpy/tests {posargs}
45 usedevelop = False
46
47 [testenv:codespell]
48 description = find common spelling mistakes in code and documentation
49 deps = codespell
50 commands = codespell {posargs}
51 usedevelop = False
52
53 [testenv:demo]
54 description = start an interactive demo with the sample config
55 commands = mudpy {posargs}
56
57 [testenv:dist]
58 description = build release artifacts and check for conformance
59 allowlist_externals = rm
60 deps =
61     build
62     twine
63 commands =
64     rm -fr {toxinidir}/dist
65     python -m build
66     twine check --strict {toxinidir}/dist/*
67 usedevelop = False
68
69 [testenv:docs]
70 # Build an sdist into a temporary location so we'll have AUTHORS and ChangeLog
71 # files to include. Keep usedevelop on so that the project dependencies will be
72 # installed in the venv.
73 description = generate hypertext documentation
74 allowlist_externals = rm
75 deps =
76     build
77     sphinx
78 commands =
79     rm -fr {toxinidir}/doc/build
80     python -m build --outdir={toxinidir}/doc/build/dist --sdist
81     sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html
82
83 [testenv:flake8]
84 description = style checks and static analysis of source code
85 deps =
86     flake8
87     flake8-bugbear
88 commands = flake8 {posargs}
89 usedevelop = False
90
91 [testenv:selftest_config]
92 description = run the selftest with the included sample config
93 commands = mudpy_selftest etc/mudpy.yaml
94
95 [testenv:yamllint]
96 # Run the selftest before checking YAML files so we'll be sure to also catch at
97 # least some which are generated by the application, making sure it creates
98 # them with the same style we enforce for those carried in the repository.
99 description = test data files for correct syntax and formatting
100 deps = yamllint
101 commands =
102     mudpy_selftest mudpy/tests/fixtures/test_daemon.yaml
103     yamllint --strict {posargs} .
104
105 [flake8]
106 show-source = True
107 exclude = .git, .tox, *lib/python*, *egg, build