On Fri, Jul 30, 2010 at 12:55 AM, Michael Foord
<fuzzy...@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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to