Testing with toxΒΆ
The pypfilt testing suite uses the pytest
framework, and uses the tox automation tool
to run the tests under Python 3.
The test cases are contained in the ./tests
directory.
To run all tests using all of the Python versions defined in tox.ini
, run:
tox
The tox.ini
contents are shown below, and include targets that check
whether the documentation in ./doc
builds correctly.
#
# Configuration file for tox, used to automate test activities.
#
# https://tox.readthedocs.io/en/latest/
#
# This configuration file defines the following test environments:
#
# test: Run the test cases in ./tests/.
# docs: Build the package documentation.
#
# To perform each of these test activities, run:
#
# tox
#
[tox]
envlist = test,docs
isolated_build = True
[base]
pkg = pypfilt
pytest = {envbindir}/py.test --cov={envsitepackagesdir}/{[base]pkg}
test_paths = {envsitepackagesdir}/{[base]pkg} tests/ doc/
[testenv:test]
deps =
.[plot]
pytest
pytest-cov
allowlist_externals =
git
commands =
{envpython} -bb {[base]pytest} {[base]test_paths} {posargs}
git diff --exit-code --stat tests/
setenv =
# Ignore ImportMismatchErrors when running doctests.
# See https://github.com/pytest-dev/pytest/issues/2042 for details.
PY_IGNORE_IMPORTMISMATCH = 1
# Do not attempt to import sphinx_rtd_theme when searching for doctests in
# doc/conf.py.
READTHEDOCS = True
[testenv:docs]
changedir = doc
deps =
sphinx>=1.4
sphinx-rtd-theme>=0.1.9
sphinxcontrib-inlinesyntaxhighlight>=0.2
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
[pytest]
addopts =
--doctest-modules
--doctest-glob='*.rst'
--capture=no
--cov-report term
--cov-report html