[pytest-dev] Running doctest for the certain function

Bruno Oliveira nicoddemus at gmail.com
Sun Dec 13 19:13:29 EST 2020


Hi Ilya,

That's the current behavior, there are no command-line/syntax to select
doctests inside files.

Cheers,
Bruno.

On Sun, Dec 13, 2020 at 8:37 PM Ilya Kazakevich via pytest-dev <
pytest-dev at python.org> wrote:

> Hello.
>
> I have some function with doctest in a file called "spam.py"
> ```
> def egg():
>     """
>     >>> egg()
>     True
>     """
>
>     return True
>   ```
>
>
> I want to run doctest using pytest:
>
> ``pytest spam.py::egg --doctest-modules``
>
> But it doesn't work:
> ==no tests ran in 0.05s ==
>
> It seems that I can't run doctest for any particular function: I can run
> it only for the whole directory.
>
> Is this behavior intentional or a bug?
>
> Thank you.
>
> Ilya.
>
>
> _______________________________________________
> pytest-dev mailing list
> pytest-dev at python.org
> https://mail.python.org/mailman/listinfo/pytest-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pytest-dev/attachments/20201213/141664fb/attachment.html>


More information about the pytest-dev mailing list