2012-03-20 54 views
1

試圖運行Plone的4.1 z3c.form.testing基於代碼並獲得此異常導入錯誤:與z3c.form.testing進口否模塊命名測試

Traceback (most recent call last): 
File "/home/xxx/DATA/projects/SVN_xxx_eggs/Products.xxxPatient/Products/xxxPatient/tests/test_views.py", line 13, in <module> 
    from z3c.form.testing import TestRequest 
File "/home/xxx/DATA/projects/xxx_FOLDER/xxx_414/buildout-cache/eggs/z3c.form-2.5.1-py2.6.egg/z3c/form/testing.py", line 23, in <module> 
    from zope.app.testing import setup 
ImportError: No module named testing 

待辦事項z3c.form需要有特殊的支持或pindowns Plone 4.1運行單元測試?可能需要在setup.py中引用測試模塊,但是有沒有例子說明如何做到這一點?

回答

2

我認爲你在這裏沒有版本問題。看來你的TestRunner找不到整個包zope.app.testing所以你只需要指定extra_requires關鍵字「測試」(拿這裏z3c.form's extras_require看看)在你的擴建是這樣的:

[buildout] 
eggs += 
    z3c.form [test] 
test-packages = 
    z3c.form 

[test] 
recipe = zc.recipe.testrunner 
defaults = ['--auto-color', '--auto-progress'] 
eggs = 
    ${buildout:eggs} 
    ${buildout:test-packages} 
+0

完美的作品。謝謝。 – 2012-04-23 16:20:34

相關問題