[Zope3-dev] Re: Python 2.4 build problem

Derrick Hudson dman at dman13.dyndns.org
Wed Jan 19 21:34:45 EST 2005


On Wed, Jan 19, 2005 at 10:01:13AM -0500, Fred Drake wrote:
| On Wed, 19 Jan 2005 14:33:30 +0100, Christian Wiese <jeru at ixplanet.org> wrote:

| > ----------------------------------------------------------------------
| > File
| > "/usr/local/src/zope3/trunk/Zope3/src/zope/app/apidoc/viewmodule/browser.py",
| > line 98, in zope.app.apidoc.viewmodule.browser.SkinLayer.getSkins
| > Failed example:
| >     pprint(skins)
| > Expected:
| >     [SkinDocumentation(u'skinA', []),
| >      SkinDocumentation(u'skinB', [u'layer1', u'layer2']),
| >      SkinDocumentation(u'skinC', [u'layer3', u'layer2'])]
| > Got:
| >     [SkinDocumentation(u'skinA', []),
| >      SkinDocumentation(u'skinB', [u'layer1', u'layer2']),
| >      SkinDocumentation(u'skinC', [u'layer2', u'layer3'])]
| 
| These seem to be broken tests; they appear to be (indirectly) relying
| on the hash values of some values and the order in which keys are
| inserted in dictionaries.

I agree.

| If that is indeed the case, the tests should be fixed to ignore the
| arbitrary ordering of the lists of values.
| 
| Stephan Richter should confirm that this is indeed the problem before
| anyone goes and changes the tests, though.

Here's what I found :

    The 'skins' variable is a list of SkinDocumentation objects.

    In the pprint() implementation, _convertToSortedSequence() is used
    to try and eliminate this dictionary ordering problem.

    SkinDocumentation objects contain a list of layers that is
    rendered in the object's __repr__().

    (The layers is dynamically computed from the registrations() method
    of the Utilities service.)

The problem is that _convertToSortedSequence() only sees a single list
because the layers are accessed via a __repr__().

utils.registrations() returns a 'dictionary-iterator object' in python
2.3 and a 'dictionary-valueiterator object' in python 2.4 and the
order of iteration changed.


I'd be curious to see if anyone has a simple and clean solution to
this problem.  I think a unit test (instead of a doctest) would work
better with an equality test instead of trying to ensure a
deterministic order of the string representation.

-D

-- 
Windows, hmmm, does it come with a GUI interface that works or just
pretty blue screens?
 
www: http://dman13.dyndns.org/~dman/            jabber: dman at dman13.dyndns.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20050119/6bc7bff0/attachment.bin


More information about the Zope3-dev mailing list