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
Tag: doctest
Get type object defined inside doctest by type name
I am trying to doc-test a method that accepts a module object module and a string with the name of the type type_name inside that module : When I am trying to get the type object with getattr (in reality, the method does more than just that), I am getting the error: Is it possible to doc-test this method without
doctest doesn’t test classes methods in a module
I can’t manage to have doctest test my modules classes methods. My module looks like that: A.py contains: (so the tests should fail) __init__.py contains And then I run Why doesn’t doctest test A.method ? Answer I found out why. Why it doesn’t work doctest tries to detect which tests don’t belong to the tested module, and doesn’t run them.