Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOC: Creating a coverage report (#1319)
- Loading branch information
1 parent
b4b8f2d
commit 3ec834d
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Testing | ||
|
||
PyPDF2 uses [`pytest`](https://docs.pytest.org/en/7.1.x/) for testing. | ||
|
||
## Creating a Coverage Report | ||
|
||
If you want to get a coverage report that considers the Python version specific | ||
code, you can run [`tox`](https://tox.wiki/en/latest/). | ||
|
||
As a prerequisite, we recommend using [`pyenv`](https://github.com/pyenv/pyenv) | ||
so that you can install the different Python versions: | ||
|
||
``` | ||
pyenv install pypy3.8-7.3.7 | ||
pyenv install 3.6.15 | ||
pyenv install 3.7.12 | ||
pyenv install 3.8.12 | ||
pyenv install 3.9.10 | ||
pyenv install 3.10.2 | ||
``` | ||
|
||
Then you can execute `tox` which will create a coverage report in HTML form | ||
in the end. The execution takes about 30 minutes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
[tox] | ||
envlist = | ||
py{36,37,38,39,310,py,py3} | ||
py{36,37,38,39,310,py3},cov | ||
|
||
[testenv] | ||
setenv= | ||
py{36,37,38,39,310,py3}: COVERAGE_FILE={envdir}/.coverage | ||
deps = | ||
pillow | ||
pytest | ||
pytest-cov | ||
pycryptodome | ||
commands = pytest tests --cov --cov-report term-missing -vv {posargs} | ||
commands = | ||
py{36,37,38,39,310,py3}: pytest tests --cov --cov-report term-missing -vv --no-cov-on-fail {posargs} | ||
cov: /usr/bin/env bash -c '{envpython} -m coverage combine {toxworkdir}/py*/.coverage' | ||
cov: coverage html --fail-under=85 |