[py-dev] Idea: pluggable comparison summaries

Ian Bicking ianb at colorstudy.com
Wed May 25 22:28:12 CEST 2005


It occurs to me that it would be nice to be able to plug different 
outputs/reports into the system, when encountering the idiomic form "x 
== y" (or !=).

For instance, one might use diff format when the strings above a certain 
length.  Or for large dictionaries, you might summarize differences 
(e.g. "x is missing key 'foo'", or "x['foo'] != y['foo']", etc.

I imagine these would be enabled in conftest.py somehow, and there'd be 
some list of them where each one could return a report or defer (maybe 
returning None).

I imagine there could be some nice hooks into the tk frontend at some 
point too, where you can display the data in some GUI-specific way. 
There should be room in the API for that somehow (though the tk frontend 
should degrade to showing strings for non-GUI-aware comparisons).

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org



More information about the Pytest-dev mailing list