nodev-io / pytest-nodev

Test-driven source code search for Python.
http://pytest-nodev.readthedocs.io
MIT License
27 stars 8 forks source link

--wish-from-* fail to load sub-modules in some cases #2

Closed alexamici closed 8 years ago

alexamici commented 8 years ago

--wish-from-* at the moment finds and imports only the top level modules.

Only sub-modules explicitly imported from top level modules are imported, as a side effect. For example import scipy doesn't trigger the import of all SciPy sub-modules.

The search for available code could be made more thorough, by using the module lookup strategies employed e.g. by IPython or using pkgutil directly.

alexamici commented 8 years ago

pkgutil.iter_modules() discovers most standard library modules (sys is missing, why?).

Update: All clear now.

alexamici commented 8 years ago

pkgutil.walk_packages is the right tool for the job. See: http://stackoverflow.com/a/1708706/2948099