Skip to content

Commit df227a0

Browse files
author
BillionClaw
committed
apacheGH-49503: [Docs][Python] Document that .pxi doctests are tested via lib.pyx
Running doctests directly on .pxi files doesn't work because they are included in lib.pyx at compile time. This adds documentation explaining: - How to run doctests on .pxi files via lib.pyx - That errors will be reported under lib.pyx, not the original .pxi filename
1 parent d6ce56e commit df227a0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,19 @@ 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 that ``.pxi`` files are included in ``lib.pyx`` at compile time, so you
199+
cannot run doctests on them directly. Instead, run doctests on ``lib.pyx``
200+
where the ``.pxi`` code is compiled into:
201+
202+
.. code-block::
203+
204+
$ pushd arrow/python
205+
$ python -m pytest --doctest-cython pyarrow/lib.pyx
206+
$ popd
207+
208+
Any doctest failures in ``.pxi`` files will be reported under ``lib.pyx``
209+
rather than the original ``.pxi`` filename.
210+
198211
Testing Documentation Examples
199212
-------------------------------
200213

0 commit comments

Comments
 (0)