[Python-Dev] PEP 399: Pure Python/C Accelerator Module Compatibiilty Requirements

James Y Knight foom at fuhm.net
Thu Apr 7 03:23:01 CEST 2011


On Apr 6, 2011, at 4:44 PM, skip at pobox.com wrote:

>    Brett> How about the test suite needs to have 100% test coverage (or as
>    Brett> close as possible) on the pure Python version?
> 
> Works for me, but you will have to define what "100%" is fairly clearly.
> 100% of the lines get executed?  All the branches are taken?  Under what
> circumstances might the 100% rule be relaxed?

And...does that include all branches taken within the interpreter too? :)

E.g. check whether all possible exceptions are thrown in all possible places an exception could be thrown? (As per the exception compatibility subthread)

And what about all the possible crazy stuff you could do in callbacks back to user code (e.g. mutating arguments passed to the initial function, or installing a trace hook or...)?

Does use of the function as a class attribute need to be covered? (see previous discussion on differences in behavior due to descriptors).

Etcetc.

I'd love it if CPython C modules acted equivalently to python code, but there is almost an endless supply of differences...100% test coverage of the behavior seems completely infeasible if interpreted strictly; some explicit subset of all possible behavior needs to be defined for what users cannot reasonably depend on. (sys.settrace almost certainly belonging on that list :).)

James


More information about the Python-Dev mailing list