Overview
This pytest plugin allows for the doctesting of C/C++ extension modules for Python created through cython.
Installation
You can install pytest-cython via pip from PyPI:
pip install pytest-cython
Usage
Basic usage:
pytest --doctest-cython
You can also run the doctests for a single .pyx file as such:
pytest --doctest-cython path/to/module.pyx
Notes
- The pytest option
--import-mode=importlibis not supported, though we would like it to be. - When using the pytest option
--import-mode=prependwith packages that are installed in a non-editable fashion, you must set the environment variablePY_IGNORE_IMPORTMISMATCH=1.
Compatibility
The following table describes the versions of Pytest and Cython the each version of the pytest-cython plugin is compatible with.
| Version | Pytest | Cython |
|---|---|---|
| 0.4.x | 9 | 3 |
| 0.3.x | 8 | 0.29, 3 |
| 0.2.x | 6, 7 | 0.29, 3 |
Issues
If you encounter any problems, please file an issue along with a detailed description.
Acknowledgements
This pytest plugin was generated with cookiecutter along with @hackebrot's cookiecutter-pytest-plugin and @ionelmc's cookiecutter-pylibrary templates.
Release files for pytest-cython 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_cython-0.4.0.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_cython-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.9 kB
Release files / pytest_cython-0.4.0.tar.gz
| Download URL | pytest_cython-0.4.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a569ab4b0f129a2b2e6c0c998ed279b11eca3144d72a313cde24a176a8729690
|
|
BLAKE2b-256 checksum How to use checksums |
f958fafbcf474da6ae2f6cf6b159e2d38d01961deada7a806f88edd926bb1b2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logRelease files / pytest_cython-0.4.0-py3-none-any.whl
| Download URL | pytest_cython-0.4.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1348912d0f8a5aaacaf156e8bb3d7c905e3fd44e1ffbafeeb201b86a88738c4
|
|
BLAKE2b-256 checksum How to use checksums |
d4f18c76e174dc69374ba847bf001c7686f9410acf1bf1e2d557441eaad4cc1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency log