[Zope-dev] CMFSetup + ZopeTestCase interaction bug

Lennart Regebro regebro at gmail.com
Wed May 25 08:26:03 EDT 2005


When you use the installProduct command of ZopeTestCase on a product
that has a CMFSetup profile you may get the following error:

File "/home/zopes/27test/Products/CMFSetup/registry.py", line 567, in
registerProfile
    raise KeyError, 'Duplicate profile ID: %s' % profile_id
KeyError: 'Duplicate profile ID: <profile id>'

This typically happens on the profile "CMFDefault:default". This also
*only* happens if you try to run all tests in Products. The reason
seem to be that all or some of the products gets installed by Zope.
When you then try to install them again with installProduct, you get
the error.

My suggested solution is to "merge" ZopeTestCases list of installed
products with Zopes list of installed products, as these for the
moment are not the same, as far as I can see.

This error happens both with Zope2.7 and 2.8.

Full traceback:
  File "/opt/Zope-2.7/bin/test.py", line 918, in ?
    process_args()
  File "/opt/Zope-2.7/bin/test.py", line 908, in process_args
    bad = main(module_filter, test_filter, libdir)
  File "/opt/Zope-2.7/bin/test.py", line 698, in main
    runner(files, test_filter, debug)
  File "/opt/Zope-2.7/bin/test.py", line 592, in runner
    s = get_suite(file, runner.result)
  File "/opt/Zope-2.7/bin/test.py", line 508, in get_suite
    mod = package_import(modname)
  File "/opt/Zope-2.7/bin/test.py", line 482, in package_import
    mod = __import__(modname)
  File "/home/zopes/Kalender/Products/CMFonFive/tests/test_typeinfo.py",
line 10, in ?
    installProduct('CMFDefault')
  File "/home/zopes/Kalender/lib/python/Testing/ZopeTestCase/ZopeLite.py",
line 128, in installProduct
    get_folder_permissions(), raise_exc=1)
  File "/opt/Zope-2.7/lib/python/OFS/Application.py", line 751, in
install_product
    initmethod(context)
  File "/home/zopes/27test/Products/CMFDefault/__init__.py", line 155,
in initialize
    BASE)
  File "/home/zopes/27test/Products/CMFSetup/registry.py", line 567,
in registerProfile
    raise KeyError, 'Duplicate profile ID: %s' % profile_id
KeyError: 'Duplicate profile ID: CMFDefault:default'

-- 
Lennart Regebro, Nuxeo     http://www.nuxeo.com/
CPS Content Management     http://www.cps-project.org/


More information about the Zope-Dev mailing list