----- "Will Woods" <wwoods(a)redhat.com> wrote:
On Wed, 2010-07-14 at 13:22 +0200, Josef Skladanka wrote:
Ahhh, okay. I read your examples (and played around a while) and I
finally understand how this works. Thanks for being patient with me!
Heh.
Oh, no need to thank me, I know, that this piece of code is a killer :)
Thank you for reviewing it so fast!
There's really no way we can define the handler to tell it to use
the
instance method, since the object instance doesn't exist - there's no
'self.run_once_failed' until there's a 'self', and there's no
'self'
when you're defining the class.
So now that I understand the advantage of using a class and
overriding
__call__(), I think that's a fine (and actually really clever) way to
handle this - so after my one last question below I think we'll be
ready
to merge this into master.
/me blushes
> > Would something like that work, or would that mess up
autotest's
> > introspection?
>
> Well, the introspection is broken once you use **kwargs somewhere in
the
> decorator (and decorators can not function without it), so the 'last
arg
> of the function has to be **kwargs when we decorate inside our
tests'
> still applies.
Interesting. Good to know.
Yes, it's because the whole method, which is 'handed' to autotest is
already decorated. The autotest introspection looks at the method,
and extracts the names of keyword arguments using some nasty magic
(if only i could remember where i found it, so i could give you
the pointer... hate my selective memory).
And because the decorated method actually has only *args, **kwargs
as parameters, it has no way to decipher it. I also tried to
re-run the introspecting code inside the decorator, but it seems,
that the call-stack inside autotest is a bit more complicated,
than one would anticipate, so after few hours of failing to repeat
magic, i decided to go KISS and just add the **kwargs parameter...
So my last question is this: Should we rename (or subclass) BaseTest
to
AutoQATest, or something like that? If plan to start adding
AutoQA-specific stuff to the class (automatic resultdb reporting, for
instance) I think it might be smart to change the name, to keep the
division between our autoqa extensions and the upstream autotest
stuff
kind of clear. (Or at least no more muddy than it already is.)
And if we're going to change the class name, we should probably do
that
before the merge. But maybe I'm just being nitpicky and we don't need
to
worry about this. What do you think?
-w
Yes, I'm deffinitely for the idea of renaming it to AutoQATest. I'm not
really good with naming stuff, so the BaseTest was more of a concept
name. And yes, lets do that before the merge, it would be unreasonable
to do it later.
The only drawback is, that i'm leaving in few hours and will be OOO
up until monday's evening, so if you could rename it, and push the first
patch to master, that would be great! And i'll test the second patch
more thoroughly during tuesday, and provide patch.
Does this seem reasonable?
Joza