Skip to content

Commit 8a8e574

Browse files
bhavanaehAlenkaF
andauthored
GH-49503: [Docs][Python] Documenting .pxi doctests are tested via lib.pyx (#49515)
### Rationale for this change Running `python -m pytest --doctest-cython` directly on `.pxi` files doesn't work because Cython `.pxi` files are included in `.pyx` files at compile time. This isn't documented, which could _potentially_ confuse contributors. Please see discussion in #49279 (comment) by @ AlenkaF for additional context. ### What changes are included in this PR? Added a `note` to the Doctest section of the Developing PyArrow documentation explaining that: - `.pxi` files cannot be tested directly with `--doctest-cython` - Doctests should be run on the `.pyx` file they are included in (e.g., `lib.pyx`) - Errors will appear under the `.pyx` file, not the original `.pxi` filename ### Are these changes tested? Documentation-only change. No code changes. ### Are there any user-facing changes? No. * GitHub Issue: #49503 Lead-authored-by: Bhavana Sundar <[email protected]> Co-authored-by: Alenka Frim <[email protected]> Signed-off-by: AlenkaF <[email protected]>
1 parent 27fdd35 commit 8a8e574

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎docs/source/developers/python/development.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,17 @@ for ``.py`` files or
195195
for ``.pyx`` and ``.pxi`` files. In this case you will also need to
196196
install the `pytest-cython <https://github.com/lgpage/pytest-cython>`_ plugin.
197197

198+
.. note::
199+
Cython ``.pxi`` files are included in ``.pyx`` files at compile time,
200+
so ``--doctest-cython`` cannot be run directly on ``.pxi`` files.
201+
In PyArrow, all ``.pxi`` files are included into ``lib.pyx``, so run
202+
doctests on that file::
203+
204+
$ python -m pytest --doctest-cython path/to/lib.pyx
205+
206+
Any doctest errors originating from ``.pxi`` files will appear under
207+
``lib.pyx``, not the original ``.pxi`` filename.
208+
198209
Testing Documentation Examples
199210
-------------------------------
200211

0 commit comments

Comments
 (0)