[TIP] testing unittest2 plugin branch Was: How to get coverage.py and unittest2 working together?
Jorge Vargas
jorge.vargas at gmail.com
Wed Jul 28 13:49:53 PDT 2010
On Thu, Jul 22, 2010 at 6:24 PM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> On 22/07/2010 21:02, Tim Hatch wrote:
> For what it's worth I'm now prototyping the extension mechanism for
> unittest/unittest2. Anyone who wants to follow along can look at the
> "plugins" branch of the repository at http://hg.python.org/unittest2
>
> It is still early days - only 3 extension points and 4 example plugins.
> coverage is one of the example plugins I will be looking at implementing in
> order to ensure that the plugin mechanism is adequate. Not done yet
> though...
>
Today I got it working without troubles. Well one little thing. Seems
like the alwaysOn logic is a bit confused, as it's trying to access a
variable that isn't set yet, the following patch will fix it.
diff -r a5b8d976c89a unittest2/events.py
--- a/unittest2/events.py Wed Jul 28 17:29:44 2010 +0100
+++ b/unittest2/events.py Wed Jul 28 14:48:48 2010 -0600
@@ -263,6 +263,7 @@
instance.config = getConfig(configSection)
alwaysOn = instance.config.as_bool('always-on', default=False)
+ instance._registered = False
if alwaysOn:
instance.register()
else:
@@ -270,7 +271,6 @@
opt, longOpt, help_text = commandLineSwitch
addOption(instance.register, opt, longOpt, help_text)
- instance._registered = False
return instance
def register(self):
More information about the testing-in-python
mailing list