[pypy-dev] Objects and types in the stdobjspace

Rocco Moretti roccomoretti at netscape.net
Fri Jun 13 05:34:05 CEST 2003


Michael Hudson <mwh at python.net> wrote:

>I've had another idea: give unittest_w.TestCase_w a metaclass that
>looks for methods called 'test_app_whatever' and arrange for such
>methods to be called as objectspace methods.

Sounds like a wonderful solution, but I have to confess that my eyes glaze 
over when trying to understand metaclasses - I probably should put more of 
an effort into learning about them one of these days...

Is using metaclasses really nessasary? Before I realized that metaclasses 
were involved, I first thought of using a special subclass of TestCase - 
probably by overloading TestCase.__call__() to appropriately wrap the 
function before it is run.

If we can use the subclass approach, we could potentially simplify things 
by having two seperate TestCase subclasses, one for interpreter level and 
one for application level tests. This would potentially require splitting 
of a single test case into two, one each for application and interpreter 
levels, whereas your implementation appears to allow both types of tests 
in the same class definition.

But feel free to ignore this as I haven't tried putting it into code and 
have no clue what the problems with it may be.

-Rocco

__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455


More information about the Pypy-dev mailing list