[ZCM] [ZC] 1357/ 2 Comment "test.py mystery import errors"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Fri May 28 17:43:54 EDT 2004


Issue #1357 Update (Comment) "test.py mystery import errors"
 Status Pending, Zope/bug low
To followup, visit:
  http://zope.org/Collectors/Zope/1357

==============================================================
= Comment - Entry #2 by slinkp on May 28, 2004 5:43 pm

in case it's not clear from the following:
the ImportError does NOT happen on the 2_7 branch, only on the trunk.

today on #zope-dev, others were able to reproduce the ImportError on the trunk, and reproduce the flawless run on the 2_7 branch.
________________________________________
= Request - Entry #1 by slinkp on May 28, 2004 5:42 pm

I checked in some unit tests at lib/python/Products/PageTemplate/test/testZopePageTemplate.py It works fine on the Zope-2_7-branch, but on the trunk, there is an oddity...  

1) it runs fine if all the Products tests are run;

2) it runs fine if only the PageTemplates tests are run, but it's the first one to run (i.e. you change the name to be first alphabetically);

3) it raises ImportError if only the PageTemplates tests are run and it's the last one to run (by being last alphabetically, which it is).

Example:

pw at kermit Zope $ python2.3 ./bin/test.py --dir lib/python/Products 
Running unit tests from /home/pw/tmp/Zope
Script (Python):filepath:1: DeprecationWarning: integer argument expected, got float
----------------------------------------------------------------------
Ran 527 tests in 132.545s

OK
pw at kermit Zope $ python2.3 ./bin/test.py --dir lib/python/Products/PageTemplates
Running unit tests from /home/pw/tmp/Zope
cannot import name getSecurityManager
['/home/pw/tmp/Zope/lib/python', '/home/pw/tmp/Zope/bin', '/home/pw/tmp/Zope', '/usr/local/lib/python', '/usr/local/lib/python/piddle', '/home/pw/bin/python', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages/Numeric', '/usr/lib/python2.3/site-packages/PIL', '/usr/lib/portage/pym']
Traceback (most recent call last):
  File "./bin/test.py", line 847, in ?
    process_args()
  File "./bin/test.py", line 837, in process_args
    bad = main(module_filter, test_filter, libdir)
  File "./bin/test.py", line 636, in main
    runner(files, test_filter, debug)
  File "./bin/test.py", line 574, in runner
    s = get_suite(file, runner.result)
  File "./bin/test.py", line 490, in get_suite
    mod = package_import(modname)
  File "./bin/test.py", line 464, in package_import
    mod = __import__(modname)
  File "/home/pw/tmp/Zope/lib/python/Products/PageTemplates/tests/test_ptfile.py", line 7, in ?
    from Products.PageTemplates.PageTemplateFile import PageTemplateFile
  File "/home/pw/tmp/Zope/lib/python/Products/PageTemplates/PageTemplateFile.py", line 21, in ?
    from Globals import package_home, DevelopmentMode
  File "/home/pw/tmp/Zope/lib/python/Globals.py", line 29, in ?
    from App.special_dtml import HTML, HTMLFile, DTMLFile
  File "/home/pw/tmp/Zope/lib/python/App/special_dtml.py", line 70, in ?
    from Shared.DC.Scripts.Bindings import Bindings
  File "/home/pw/tmp/Zope/lib/python/Shared/DC/Scripts/Bindings.py", line 17, in ?
    from AccessControl import getSecurityManager
ImportError: cannot import name getSecurityManager

pw at kermit Zope $ mv lib/python/Products/PageTemplates/tests/testZopePageTemplate.py lib/python/Products/PageTemplates/tests/testAAAAAA.py
pw at kermit Zope $ python2.3 ./bin/test.py --dir lib/python/Products/PageTemplates
Removing stale bytecode file ./lib/python/Products/PageTemplates/tests/testZopePageTemplate.pyc
Running unit tests from /home/pw/tmp/Zope
----------------------------------------------------------------------
Ran 44 tests in 8.997s

OK

==============================================================




More information about the Zope-Collector-Monitor mailing list