[pypy-dev] App-space tests
Michael Hudson
mwh at python.net
Mon Jun 16 20:13:24 CEST 2003
Michael Hudson <mwh at python.net> writes:
> roccomoretti at netscape.net (Rocco Moretti) writes:
>
>> 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...
>
> I should probably be worried at the willingness with which I now reach
> for them.
>
>> Is using metaclasses really nessasary?
>
> Heh. No, probably not.
>
>> 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.
>
> Yes, that would probably work.
And it does, after a fashion. Well, it works fine as far as I can
tell, it's just that running the assertFoo methods in app-space *too*
(what the attached does) isn't ideal. OTOH, the fact that doing so
*works* is something we can be proud of.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pypy-appspace-tests-2.diff
Type: text/x-patch
Size: 6332 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20030616/21319424/attachment.bin>
-------------- next part --------------
The only decision to be made is: do we distinguish between app-space
tests by a naming convention (as attached: any test starting test_app_
runs in app space) or by inheriting from a different TestCase
subclass? I can't make my mind up which I prefer.
In either case, I want to check something like this in, soon. The
implementation can be made more elegant/faster in due course.
Cheers,
M.
--
Just point your web browser at http://www.python.org/search/ and
look for "program", "doesn't", "work", or "my". Whenever you find
someone else whose program didn't work, don't do what they
did. Repeat as needed. -- Tim Peters, on python-help, 16 Jun 1998
More information about the Pypy-dev
mailing list