[Python-Dev] Re: how to test behavior wrt an extension type?

Anthony Baxter anthony at interlink.com.au
Mon Jan 17 14:45:09 CET 2005


On Sunday 16 January 2005 20:38, Alex Martelli wrote:
> Problem: to write unit tests showing that the current copy.py
> misbehaves with a classic extension type, I need a classic extension
> type which defines __copy__ and __deepcopy__ just like /F's
> cElementTree does.  So, I made one: a small trycopy.c and accompanying
> setup.py whose only purpose in life is checking that instances of a
> classic type get copied correctly, both shallowly and deeply.  But now
> -- where do I commit this extension type, so that the unit tests in
> test_copy.py can do their job...?

> I do not know what the recommended practice is for this kind of issues,
> so, I'm asking for guidance (and specifically asking Anthony since my
> case deals with 2.3 and 2.4 maintenance and he's release manager for
> both, but, of course, everybody's welcome to help!).  Surely this can't
> be the first case in which a bug got triggered only by a certain
> behavior in an extension type, but I couldn't find precedents.  Ideas,
> suggestions, ...?

Beats me - worst comes to worst, I guess we ship the unittest code 
there with a try/except around the ImportError on the new 'copytest'
module, and the test skips if it's not built. Then we don't build it by
default, but if someone wants to build it and check it, they can. I don't
like this much, but I can't think of a better alternative. Shipping a new
extension module just for this unittest seems like a bad idea.

Anthony

-- 
Anthony Baxter     <anthony at interlink.com.au>
It's never too late to have a happy childhood.


More information about the Python-Dev mailing list