Skip to content
Advertisement

Doctest not working in Sphinx, cannot import python files Python

I have a problem trying to run doctest from the Sphinx Tutorial. I have the directory tree below but I cannot run a doctest for lumache.py. How would be able to make it so that lumache.py is importable with the pathlib function in conf.py which is sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix()).The code I am trying to execute is of the same one from the tutorial (hyperlink mentioned in the first sentence).

conf.py Contents

JavaScript

Contents of lumache.py

JavaScript

CMD execution

JavaScript

Directory Tree:

JavaScript

Advertisement

Answer

Move lumache.py to your project folder (i.e. same folder as where docs/ currently is).

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement