How do I run the doctest for only a single function in python using the command line? I can python3 -m doctest -v main.py
but this will run all the doctests in main.py. How do I specify one function to call the doctest on?
Asked
Active
Viewed 805 times
0

Shams Ansari
- 762
- 5
- 12
2 Answers
1
That depends on the code in main.py that runs the doctests. You can change that code to test a specific function by calling doctest.run_docstring_examples()
.
When that code runs doctest.testmod()
however, you cannot limit testing to a single function from the command line.

René Pijl
- 4,310
- 1
- 19
- 25
-
Thanks, seems like there isn't a way to do it from the command line! – Shams Ansari Jul 16 '21 at 20:07