[qmtest] Upgrading tests

Mark Mitchell mark at codesourcery.com
Fri Jan 2 22:07:36 UTC 2004


> The upgrade logic is
> 1. Old test is loaded
> 2. Instance of new test class is created
> 3. Method 'Upgrade' on the new instance is called with the old class instance
> 4. The test is saved.

That seems like a good plan.

> I'd be happy to send the patch, if there's interest, but there are two things 
> I don't like and would prefer to cleanup -- and that requires some 
> discussion.
> 
> First, problem is that database can't save tests, only instances of 
> TestDescriptor. I'm thinking that either database should be able to save 
> tests, too, or there should be a method in  Test which return TestDescriptor. 

That's a valid objection.  Zack has been complaining about
non-orthogonalities in Database for some time; I will see if I can work
on the issue that you raise.  I think I know how to clean this up in a
relatively nice way.

> The biggest problem is that it's hard to create default-initialized instance 
> of new test class. I can pass empty mapping for arguments, but 
> Runnable.__init__ expects 'extra' keyword arguments. I can work around this, 
> too, by passing what Runnable expects, but this starts to be rather messy. 
> E.g., if Runnable is changes to require another extra keyword argument, my 
> code will break. Is there some way I can cleanly create default-initialized 
> test instance?

In the short term, I suggest that we change Runnable to simply set __id
and __database to "None" if no corresponding value is foundin extras. 
Then, you can just ignore the "extras" argument.

-- 
Mark Mitchell <mark at codesourcery.com>
CodeSourcery, LLC




More information about the qmtest mailing list