How to make pytest run doctests as well as normal tests directory? How to make pytest run doctests as well as normal tests directory? python python

How to make pytest run doctests as well as normal tests directory?


Now it is implemented :-).

To use, either run py.test --doctest-modules command, or set your configuration with pytest.ini:

$ cat pytest.ini# content of pytest.ini[pytest]addopts = --doctest-modules

Man page: PyTest: doctest integration for modules and test files.


Could you try with the repo version of pytest and paste a session log? I'd think --doctest-modules should pick up any .py files.


worked with doctest as well as with plain tests in one module. for a non-doctest test to be picked up, standard py.test discovery mechanism applies: a module name with test prefix, test function with test prefix.