6

In my Python project, I'm using Pytest. The directory structure is:

src/
docs/
test/

I have a different kind of tests:

  1. normal tests, in test/*
  2. doctests in the source, src/*
  3. doctests in documentation, docs/*.rst (Sphinx)

I'd like to run all of them at once, so I can aggregate statistics on all of them (e.g. coverage).

  • For 1. : just pytest
  • For 2. : pytest --doctest-modules src
  • For 3. : pytest --doctest-glob="docs/*.rst" docs

I managed to run pairs of them:

  • For 1-2: pytest --doctest-modules src test
  • For 1-3: pytest --doctest-glob="docs/source/*.rst"

How to run all of them in one single command? Maybe the problem is simpler than I think...

mzjn
  • 48,958
  • 13
  • 128
  • 248
Marco Favorito
  • 390
  • 3
  • 14

0 Answers0