[Zope-CMF] GenericSetup: bbq branch

Maurits van Rees m.van.rees at zestsoftware.nl
Wed May 16 12:13:36 EDT 2007


Hi,

I took a look at the GS branch from the bbq sprint:

svn://svn.zope.org/repos/main/GenericSetup/branches/tseaver-bbq_sprint
or in the browser:
http://svn.zope.org/GenericSetup/branches/tseaver-bbq_sprint/

With this post I hope to spread a small beam of light on some failing
tests and get some motion on this branch again.


There are failing tests in the test_zcml.py file, along these lines:

$ bin/zopectl test -s Products.GenericSetup -m test_zcml
...
File
"/home/maurits/instances/plone3/Products/GenericSetup/tests/test_zcml.py",
line 197, in Products.GenericSetup.tests.test_zcml.test_registerUpgradeSteps
Failed example:
    step1.title
Expected:
    u'Bar Upgrade Step 1'
Got:
    u'Foo Upgrade Step 1'


Probably the main authors of that branch already know why this fails.
The problem there is that the upgrade steps are in the wrong order.
And the part of the code that is tested here does not do anything with
the sortkey.  So the upgrade steps end up in the wrong order.

I do not know if this means that the tests need to be changed or if
the underlying code needs to be changed.  If the tests simply need
changing, then this may be a start.  Instead of this:

   >>> from Products.GenericSetup.upgrade import _upgrade_registry
   >>> profile_steps = _upgrade_registry.getUpgradeStepsForProfile('default')

do this:

   >>> from Products.GenericSetup.upgrade import _upgrade_registry
   >>> from Products.GenericSetup.upgrade import listUpgradeSteps
   >>> profile_steps = listUpgradeSteps(_upgrade_registry, 'default', '1.0')

The reason is that the listUpgradeSteps function looks to be the only
function that actually does anything with the sortkey.  I might be
wrong.

I have diff here that does this and fixes up some more related tests:

http://paste.plone.org/14641

Or the most important part of that test file in new form:

http://paste.plone.org/14642

But that introduces new errors like this:

        step1.handler
    AttributeError: 'dict' object has no attribute 'handler'

These are unavoidable when you use the listUpgradeSteps function
though, as that returns a list with a list of dicts which indeed have
no 'handler' attribute.


I hope this report helps someone who has more clue. ;-) Maybe I can
take another look later.  At any rate, the branch looks very useful
and I want it in trunk yesterday. :)

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."



More information about the Zope-CMF mailing list