Skip to content

Run doctest on module containing relative import

License

Notifications You must be signed in to change notification settings

Mortal/doctestmod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Run doctest on module containing relative import

When running doctest on a module that performs a relative import in a PEP-420 namespace package, you get an ugly error saying

Parent module '' not loaded, cannot perform relative import

This program imports the module using importlib and runs doctest.testmod on that to resolve this problem.

You may specify either a dot-separated module path or a filename relative to the current directory.

If you specify a filename like foo/bar/baz.py, this program will add the current working directory to PYTHONPATH and import foo.bar.baz. If instead you specify foo.bar.baz directly, PYTHONPATH is not modified.

About

Run doctest on module containing relative import

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages