[qmtest] derivation issues?
Mark Mitchell
mark at codesourcery.com
Thu Dec 19 22:57:11 UTC 2002
--On Tuesday, December 17, 2002 03:35:38 PM -0500 "eichin at metacarta.com"
<eichin at metacarta.com> wrote:
> Today's problem: how does one set argument values in parent classes
> correctly? In particular, I've got something derived from
> ShellScriptTest that runs a find [and does some other things with
> arguments, so it isn't just an instance, it is a new class of test.]
>
> I can just set self.script in the the Run method, before calling the
> parent Run... but I'd really like to, for example, set Hidden on that
> argument, or at least set the default_value to my find command so that
> the user sees it. Thoughts?
The way this was supposed to work is that you would just redefine the
argument in the derived class (probably using the "computed" attribute,
so that it wouldn't show up.) Like so:
class DerivedClass(ShellScriptTest):
arguments = [TextField(name = "script", computed = 1)]
__init__(...):
self.script = "find . -name foo"
However, we blew it in that extension.get_class_arguments is going
to find both arguments. That's easily fixed by removing duplicates
in that function, but before we do that, will it work for you?
--
Mark Mitchell mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the qmtest
mailing list