基于plone.app.testing的测试无限期挂起,并且不会将控制权返回给shell

时间:2012-05-29 22:42:10

标签: plone

在我使用bin/test跑步者测试失败后,当我假设控件应该返回终端时,我得到以下异常:

  Traceback (most recent call last):
    File "bin/test", line 374, in <module>
      '--test-path', '/fast/xxx3/src/xxx-eggs/Products.xxxHospital',
    File "/fast/buildout-cache/eggs/zope.testing-3.9.7-py2.6.egg/zope/testing/testrunner/__init__.py", line 35, in run
      failed = run_internal(defaults, args, script_parts=script_parts)
    File "/fast/buildout-cache/eggs/zope.testing-3.9.7-py2.6.egg/zope/testing/testrunner/__init__.py", line 48, in run_internal
      runner.run()
    File "/fast/buildout-cache/eggs/zope.testing-3.9.7-py2.6.egg/zope/testing/testrunner/runner.py", line 138, in run
      self.run_tests()
    File "/fast/buildout-cache/eggs/zope.testing-3.9.7-py2.6.egg/zope/testing/testrunner/runner.py", line 242, in run_tests
      tear_down_unneeded(self.options, (), setup_layers, True)
    File "/fast/buildout-cache/eggs/zope.testing-3.9.7-py2.6.egg/zope/testing/testrunner/runner.py", line 605, in tear_down_unneeded
      l.tearDown()
    File "/fast/buildout-cache/eggs/plone.app.testing-4.0.2-py2.6.egg/plone/app/testing/helpers.py", line 351, in tearDown
      with z2.zopeApp() as app:
    File "/Users/moo/code/python/parts/opt/lib/python2.6/contextlib.py", line 16, in __enter__
      return self.gen.next()
    File "/fast/buildout-cache/eggs/plone.testing-4.0.3-py2.6.egg/plone/testing/z2.py", line 242, in zopeApp
      app = addRequestContainer(Zope2.app(connection), environ=environ)
    File "/fast/buildout-cache/eggs/Zope2-2.13.12-py2.6.egg/Zope2/__init__.py", line 52, in app
      return bobo_application(*args, **kw)
    File "/fast/buildout-cache/eggs/Zope2-2.13.12-py2.6.egg/App/ZApplication.py", line 75, in __call__
      return connection.root()[aname]
    File "/fast/buildout-cache/eggs/ZODB3-3.10.5-py2.6-macosx-10.7-x86_64.egg/ZODB/Connection.py", line 366, in root
      return RootConvenience(self.get(z64))
    File "/fast/buildout-cache/eggs/ZODB3-3.10.5-py2.6-macosx-10.7-x86_64.egg/ZODB/Connection.py", line 248, in get
      p, serial = self._storage.load(oid, '')
  AttributeError: 'NoneType' object has no attribute 'load'

(明显与ZODB内部有关?)

然后执行就在那里。

CTRL + C什么都不做。

退出测试过程的唯一方法是CTRL + Z退出然后kill %1

有什么想法吗? OSX。

2 个答案:

答案 0 :(得分:4)

当我无法为某些人正确加载zcml时,我看到过类似的回溯 包我的测试依赖于。您是否检查了设置以确保正确加载/安装了所有需要的部件?

答案 1 :(得分:2)

我发现的原因有两个:

  1. 加载“依赖”ZCML的问题正如@Chris Ewing所说。我用

    xmlconfig.string(
        '<configure xmlns="http://namespaces.zope.org/zope">'
        '  <include package="z3c.autoinclude" file="meta.zcml" />'
        '  <includePlugins package="plone" />'
        '  <includePluginsOverrides package="plone" />'
        '</configure>',
        context=configurationContext)
    

    触发z3c.autoload。

  2. 测试基础的顺序问题。我有两个这样的基地:

               PLONE_FIXTURE     PLONE_FIXTURE
                   \                  / 
    LAYER =      (MY_FIXTURE1,  MY_FIXTURE2, )
    

    它适用于

     PLONE_FIXTURE -> MY_FIXTURE1 -> MY_FIXTURE2
    
     LAYER = (MY_FIXTURE2,)
    
  3. - 汤姆