On Fri, Jul 30, 2010 at 12:55 AM, Michael Foord <fuzzyman at voidspace.org.uk> wrote: ... > > The Plugin Class > ================ > > A sometimes-more-convenient way of creating plugins is to subclass the > ``unittest2.events.Plugin`` class. By default subclassing ``Plugin`` will > auto-instantiate the plugin and store the instance in a list of loaded > plugins. > > Each plugin has a ``register()`` method that auto-hooks up all methods whose > names correspond to events. Plugin classes may also provide > ``configSection`` and ``commandLineSwitch`` class attributes which > simplifies enabling the plugin through the command line and making available > a section from the configuration file(s). What about using ABCs here instead ? The big advantage is that you don't force people to subclass your Plugin base class, and you get a registration mechanism for free. They would be able to explicitly register any class using : from unittest2.events import Plugin Plugin.register(MySuperPlugin) Regards Tarek -- Tarek Ziadé | http://ziade.org
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4