2014-02-17 19 views
0

我面對我們的遷移Plone站點使用plone.app.testing的問題。我將消息Test-module import failures作爲控制檯上輸出的第一行。遷移到plone.app.testing後測試模塊導入失敗 - 顯然圓形進口

C:\sandbox\cms.buildout>bin\test -s soschildrensvillages 
Test-module import failures: 

Module: soschildrensvillages.contenttypes.tests.test_portlet_concept_news 

Traceback (most recent call last): 
... 
    File "c:\sandbox\cms.buildout\src\soschildrensvillages\soschildrensvillages\contenttypes\content\concept_folder.py", line 7, in <module> 
    from plone.app.folder.folder import ATFolder 
    File "c:\sandbox\cms.buildout\eggs\plone.app.folder-1.0.5-py2.7.egg\plone\app\folder\folder.py", line 4, in <module> 
    from Products.ATContentTypes.interface import IATFolder 
    File "c:\sandbox\cms.buildout\eggs\products.atcontenttypes-2.1.13-py2.7.egg\Products\ATContentTypes\__init__.py", line 32, in <module> 
    import Products.ATContentTypes.content 
    File "c:\sandbox\cms.buildout\eggs\products.atcontenttypes-2.1.13-py2.7.egg\Products\ATContentTypes\content\__init__.py", line 7, in <module> 
    import Products.ATContentTypes.content.folder 
    File "c:\sandbox\cms.buildout\eggs\products.atcontenttypes-2.1.13-py2.7.egg\Products\ATContentTypes\content\folder.py", line 19, in <module> 
    from plone.app.folder import folder 
ImportError: cannot import name folder 

還有更多的輸入錯誤,因爲它試圖建立測試層和運行測試。只有單元測試(普通的TestCase)運行沒有錯誤。

這些錯誤只是開始出現後,我從Products.PloneTestCase遷移的最後一次測試,幷包括我們testing.py模塊中的以下行來解決這個問題。

from Products.PloneTestCase import PloneTestCase as ptc 

我不確定某人需要什麼樣的細節水平才能在這裏幫助,但任何指向我可以嘗試的東西都將不勝感激。

我們testing.py看起來像

products = ('collective.lineage', 'soschildrensvillages') 


class SOSChildrenLayer(PloneWithPackageLayer): 

    defaultBases = (PLONE_FIXTURE,) 

    def __init__(self): 
     super(SOSChildrenLayer, self).__init__(
       zcml_filename='configure.zcml', zcml_package=soschildrensvillages, 
       additional_z2_products=products, gs_profile_id='soschildrensvillages:default' 
     ) 

    def setUpZCMLFiles(self): 
     super(SOSChildrenLayer, self).setUpZCMLFiles() 
     self.loadZCML(name='overrides.zcml', package=soschildrensvillages) 

    def tearDownZope(self, app): 
     super(SOSChildrenLayer, self).tearDownZope(app) 
     for product in products: 
      z2.uninstallProduct(app, product) 


SOS_CHILDREN_FIXTURE = SOSChildrenLayer() 
SOS_CHILDREN_INTEGRATION_TESTING = IntegrationTesting(
     bases=(SOS_CHILDREN_FIXTURE,), 
     name="SOSChildren:Integration" 
    ) 

在setup.py我們

install_requires=[ 
     'setuptools', 

     'collective.lineage', 

     'plone.app.caching', 
     'plone.app.folder', 
     'plone.app.iterate', 

     'quintagroup.seoptimizer', 

     'rdflib', 

     'soschildrensvillages.taxonomy',   
     'soschildren.contentexperiments',   

     'Products.AdvancedQuery', 
     'Products.ATContentTypes', 
     'Products.CMFPlone', 
     'Products.CMFPlacefulWorkflow' 
     # -*- Extra requirements: -*- 
    ], 

在configure.zcml中,我們有

<includeDependencies package="." /> 

concept_folder.py包括定義一個Archetypes內容類型。

回答

0

我確保我從進口的東西Products.ATContentTypes我的模塊中plone.app.folder之前在錯誤被始發固定這一點。

之前

from plone.app.folder.folder import ATFolder 
from plone.app.folder.folder import ATFolderSchema 
from Products.ATContentTypes.content.schemata import finalizeATCTSchema 

from Products.ATContentTypes.content.schemata import finalizeATCTSchema 
from plone.app.folder.folder import ATFolder 
from plone.app.folder.folder import ATFolderSchema 
相關問題