For code tests,
sphinx-proof uses pytest.
Run the tests with the following command:
>> cd sphinx-proof >> pip install -e .[testing] >> pytest
To run the tests in multiple isolated environments, you can also run tox
>> cd sphinx-proof >> tox
To test the build of documentation run
>> cd sphinx-proof >> tox docs-update
>> cd sphinx-proof/docs >> make clean >> make html
To run tests with coverage and an html coverage report:
pytest -v --cov=sphinx_proof --cov-report=html
sphinx.testing is used to run sphinx builds for tests, in a temporary directory.
If creating a new source folder for test files, folder name should start with
Your folder should reside inside the
tests/books directory, which has been set as the root directory for tests.
The tests should start with:
In the above declaration,
html builder is used. And
mybook is the source folder which was created with the name
Sphinx Application API is available as a parameter to all the test functions:
@pytest.mark.sphinx('html', testroot="mybook") def mytest(app):
[code style] will make the pre-commit package available which will make sure the style is met before your commits are submitted. In addition, it will reformat for any lint errors.
pre-commit run the following
cd sphinx-proof pre-commit install
flake8 can be run separately:
>>> black . >>> flake8 .