[qmtest] Specifying arguments in derived test classes

Vladimir Prus ghost at cs.msu.su
Mon May 6 13:49:06 UTC 2002


Mark Mitchell wrote:
> --On Monday, April 15, 2002 07:33:05 PM +0400 Vladimir Prus
>
> <ghost at cs.msu.su> wrote:
> > Mark Mitchell wrote:
> >> <ghost at cs.msu.su> wrote:
> >> > Hi,
> >> > I'm trying to create a test class that would derive from
> >> > python.ExecTest and  change it a little. In particular, I want to get
> >> > rid of 'expession' argument.  I'm trying the following:
> >>
> >> There's no easy way to do this.
> >>
> >> The plan is to add "computed arguments" which would solve this problem.
> >> For the time being, you have no real choice but to create a whole new
> >> class.
> >>
> >> (At one point, it was possible to do approximately what you wanted;
> >> each class could completely override "arguments".  We decided this was
> >> a bad design since that meant that derived classes had to explicitly
> >> list the arguments from the base classes, and there was no guarantee
> >> that the "is-a" relationship would be preserved.)
> >
> > Actually, I don't think that there's the need to explicitly list
> > arguments.  Why the following is not appropriate:
> >
> > class Test(python.ExecTest):
> >
> > 	arguments = [ ...... ] + python.ExecTest.arguments
> >
> > 	..........
>
> Yes, that's exactly how it used to work.  We decided that a better
> approach would be to allow derived classes to indicate that some
> arguments could be computed by base classes instead -- but that has
> not yet been implemented.

Can you detail how you planned the classes to indicate that arguments should 
be comptued? The simplest way I see is to allow declaring either class 
variable 'arguments' or function 'arguments'. In the former case that 
function will return final arguments list. It will be easy to implement 
(AFAIKT, there's only one place where arguments list are computed) and I can 
do it.

> Another approach would be to make your new class a base class, and
> derived ExecTest from that.

I don't follow you here. Can you explain?

- Volodya

- Volodya



More information about the qmtest mailing list