cleanup py.test.* namespace, docstrings for improved pydoc and interactive usage.

use new apipkg __onfirstaccess__ feature to initialize the py.test namespace with the default plugins.  This, besides other good implications, means that you can now type:  pydoc py.test   or help(py.test)

--HG--
branch : trunk
This commit is contained in:
holger krekel
2009-12-29 16:29:48 +01:00
parent 080fd2880e
commit db21cac694
13 changed files with 98 additions and 36 deletions

View File

@@ -15,8 +15,6 @@ def check_old_use(mod, modname):
assert not hasattr(mod, clsname), (mod, clsname)
class PluginManager(object):
class Error(Exception):
"""signals a plugin specific error."""
def __init__(self):
self.registry = Registry()
self._name2plugin = {}
@@ -157,6 +155,7 @@ class PluginManager(object):
dic = self.call_plugin(plugin, "pytest_namespace", {}) or {}
for name, value in dic.items():
setattr(py.test, name, value)
py.test.__all__.append(name)
if hasattr(self, '_config'):
self.call_plugin(plugin, "pytest_addoption",
{'parser': self._config._parser})