Skip to content

Commit 6e20805

Browse files
committed
DOC: Creating a coverage report
1 parent 1252a49 commit 6e20805

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

docs/dev/testing.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Testing
2+
3+
PyPDF2 uses [`pytest`](https://docs.pytest.org/en/7.1.x/) for testing.
4+
5+
## Creating a Coverage Report
6+
7+
If you want to get a coverage report that considers the Python version specific
8+
code, you can run [`tox`](https://tox.wiki/en/latest/).
9+
10+
As a prerequisite, we recommend using [`pyenv`](https://github.com/pyenv/pyenv)
11+
so that you can install the different Python versions:
12+
13+
```
14+
pyenv install pypy3.8-7.3.7
15+
pyenv install 3.6.15
16+
pyenv install 3.7.12
17+
pyenv install 3.8.12
18+
pyenv install 3.9.10
19+
pyenv install 3.10.2
20+
```
21+
22+
Then you can execute `tox` which will create a coverage report in HTML form
23+
in the end. The execution takes about 30 minutes.

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ You can contribute to `PyPDF2 on Github <https://github.com/py-pdf/PyPDF2>`_.
6060
dev/pdf-format
6161
dev/cmaps
6262
dev/deprecations
63+
dev/testing
6364

6465
.. toctree::
6566
:caption: About PyPDF2

tox.ini

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
[tox]
22
envlist =
3-
py{36,37,38,39,310,py,py3}
3+
py{36,37,38,39,310,py3},cov
44

55
[testenv]
6+
setenv=
7+
py{36,37,38,39,310,py3}: COVERAGE_FILE={envdir}/.coverage
68
deps =
79
pillow
810
pytest
911
pytest-cov
1012
pycryptodome
11-
commands = pytest tests --cov --cov-report term-missing -vv {posargs}
13+
commands =
14+
py{36,37,38,39,310,py3}: pytest tests --cov --cov-report term-missing -vv --no-cov-on-fail {posargs}
15+
cov: /usr/bin/env bash -c '{envpython} -m coverage combine {toxworkdir}/py*/.coverage'
16+
cov: coverage html --fail-under=85

0 commit comments

Comments
 (0)