You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2022/03/24 10:36:00 UTC

[jira] [Commented] (ARROW-16018) [Doc][Python] Run doctests on Python docstring examples

    [ https://issues.apache.org/jira/browse/ARROW-16018?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17511764#comment-17511764 ] 

Joris Van den Bossche commented on ARROW-16018:
-----------------------------------------------

Pytest itself doesn't directly support running the doctests in cython files. There is a {{pytest-cython}} plugin that allows this. 

Its released version is however not very up to date, and only allows to run all doctests. With the master version ({{pip install git+https://github.com/lgpage/pytest-cython.git}}), you can run the doctests for a specific file with:

{code}
pytest --doctest-cython python/pyarrow/_csv.pyx
{code}

> [Doc][Python] Run doctests on Python docstring examples
> -------------------------------------------------------
>
>                 Key: ARROW-16018
>                 URL: https://issues.apache.org/jira/browse/ARROW-16018
>             Project: Apache Arrow
>          Issue Type: Test
>          Components: Documentation, Python
>            Reporter: Joris Van den Bossche
>            Priority: Major
>
> We start to add more and more examples to the docstrings of Python methods (ARROW-15367), and so we could use the doctest functionality to ensure that those examples are actually correct (and keep being correct).
> Pytest has integration for doctests (https://docs.pytest.org/en/6.2.x/doctest.html), and so you can do:
> {code}
> pytest python/pyarrow --doctest-modules
> {code}
> This currently fails for me because not having pyarrow.cuda, so we will need to find some ways to automatically skips those parts if not available.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)