[py-svn] r61812 - py/branch/pytestplugin/py/doc
hpk at codespeak.net
hpk at codespeak.net
Thu Feb 12 21:20:40 CET 2009
Author: hpk
Date: Thu Feb 12 21:20:38 2009
New Revision: 61812
Modified:
py/branch/pytestplugin/py/doc/plugin.txt
Log:
an example that passes the doctest
Modified: py/branch/pytestplugin/py/doc/plugin.txt
==============================================================================
--- py/branch/pytestplugin/py/doc/plugin.txt (original)
+++ py/branch/pytestplugin/py/doc/plugin.txt Thu Feb 12 21:20:38 2009
@@ -9,26 +9,12 @@
::
>>> class MyPlugin:
- def pyevent_pluginregister(self, plugin):
- print "registering", plugin
- ...
+ ... def pyevent_pluginregistered(self, plugin):
+ ... print "registering", plugin.__class__.__name__
+ ...
>>> import py
>>> py.plugin.register(MyPlugin())
- registering <MyPlugin at 0x129031>
-
-registering a plugin at import time
-++++++++++++++++++++++++++++++++++++++++++
-
-::
- import py
- class EventLogger:
- def pyevent_PluginAdded(self, event):
- print "adding plugin", event.pluginobj
- py.plugin.register(EventLogger())
-
-explanation: on import this will add and activate a plugin that
-will subsequently print information on events
-whose class name is "PluginAdded".
+ registering MyPlugin
logging all events caused by py lib
++++++++++++++++++++++++++++++++++++++++
More information about the pytest-commit
mailing list