Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Creating a coverage report #1319

Merged
merged 1 commit into from
Sep 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/dev/testing.md
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:/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.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ You can contribute to `PyPDF2 on Github <https:/py-pdf/PyPDF2>`_.
dev/pdf-format
dev/cmaps
dev/deprecations
dev/testing

.. toctree::
:caption: About PyPDF2
Expand Down
9 changes: 7 additions & 2 deletions tox.ini
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