2012-05-07 30 views
0

无模块当我尝试运行RichDocuments单元测试,我得到一个错误:Plone的单元测试发现导入错误

[[email protected]:~/sandbox/trunk/eggs/Products.RichDocument-3.0.2-py2.4.egg/Products/RichDocument/tests]$ python ./testSetup.py 
Traceback (most recent call last): 
File "./testSetup.py", line 1, in ? 
from Products.RichDocument.tests import base 
ImportError: No module named RichDocument.tests 

1)这是否与我的Python路径呢?

2)我看到here它说:你可能必须设置环境变量INSTANCE_HOME和SOFTWARE_HOME。前者应该指向你的Zope实例(你的Products文件夹的父目录),后者应该指向安装Zope的python库目录,例如, /usr/local/zope-2.8.4/lib/python。

我该如何设置?在http://localhost:8380/manage的控制面板,它说:

SOFTWARE_HOME 
/home/jd/sandbox/trunk/parts/zope2/lib/python 

INSTANCE_HOME 
/home/jd/sandbox/trunk/parts/client 

回答

1

您使用的扩建? (如果没有,为什么不呢?)

如果你是,确保你有一个TestRunner的部分:

[test] 
recipe = zc.recipe.testrunner 
eggs = 
    ${buildout:test-packages} 

现在,您可以通过运行测试:bin/test -s PACKAGE和你的路径将被正确设置

+0

我正在使用buildout,我正在按照该站点上的说明进行操作。当我厌倦了你的建议,我包括: [测试] 配方= zc.recipe.testrunner 鸡蛋= Products.RichDocument 但是当我跑扩建我: ... 获得了“zc.recipe.testrunner分布”。 由于zc.buildout或正在使用的配方中的错误而发生内部错误: ... AttributeError:'NoneType'对象没有属性'endswith' –

+0

忘记提及您正在显示的内容在构建片段中,您需要设置“test-packages”的值 – vangheem

+0

@vangheem当然。但杰基的确定了这一点。 Jackie:使用mr.developer插件从源代码控制获取开发包(记录在'develop.cfg'文件中) – Auspex

0

该错误是因为分发包不包含测试。如果你想运行软件包的测试,你需要检查它,设置buildout来开发这个软件包,然后像Auspex描述的那样运行测试。