2012-05-07 33 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描述的那樣運行測試。