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

前端 未结 4 1282
南方客
南方客 2021-01-01 14:54

We currently have pytest with the coverage plugin running over our tests in a tests directory.

What\'s the simplest way to also run doctest

4条回答
  •  一个人的身影
    2021-01-01 15:36

    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.

提交回复
热议问题