GH-49503: [Docs][Python] Documenting .pxi doctests are tested via lib.pyx#49515
GH-49503: [Docs][Python] Documenting .pxi doctests are tested via lib.pyx#49515bhavanaeh wants to merge 1 commit intoapache:mainfrom
Conversation
|
|
| for ``.pyx`` and ``.pxi`` files. In this case you will also need to | ||
| install the `pytest-cython <https://github.com/lgpage/pytest-cython>`_ plugin. | ||
|
|
||
| .. note:: |
There was a problem hiding this comment.
I went with a .. note:: block to make this stand out, but happy to change it to inline text if that's preferred.
|
|
|
@github-actions crossbow submit preview-docs |
|
Revision: ecff1a1 Submitted crossbow builds: ursacomputing/crossbow @ actions-bfd9f4b8a6
|
AlenkaF
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Adding one comment from my side.
| for ``.pyx`` and ``.pxi`` files. In this case you will also need to | ||
| install the `pytest-cython <https://github.com/lgpage/pytest-cython>`_ plugin. | ||
|
|
||
| .. note:: |
| Cython ``.pxi`` files are included in ``.pyx`` files at compile time, | ||
| so ``--doctest-cython`` cannot be run directly on ``.pxi`` files. | ||
| Instead, run doctests on the ``.pyx`` file they are included in, for | ||
| example ``lib.pyx``:: | ||
|
|
||
| $ python -m pytest --doctest-cython pyarrow/lib.pyx | ||
|
|
||
| Any doctest errors originating from ``.pxi`` files will appear under | ||
| the corresponding ``.pyx`` file, not the original ``.pxi`` filename. |
There was a problem hiding this comment.
In PyArrow all the .pxi files are included into one .pyx file, namely lib.pyx, see:
Lines 197 to 246 in d08d5e6
Therefore we can make the more general (though correct) statement here into a more concrete and clear that all the .pxi files in this case will be part of the lib.pyx and not any other .pyx file.
Rationale for this change
Running
python -m pytest --doctest-cythondirectly on.pxifiles doesn't work because Cython.pxifiles are included in.pyxfiles 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
noteto the Doctest section of the Developing PyArrow documentation explaining that:.pxifiles cannot be tested directly with--doctest-cython.pyxfile they are included in (e.g.,lib.pyx).pyxfile, not the original.pxifilenameAre these changes tested?
Documentation-only change. No code changes.
Are there any user-facing changes?
No.