Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archetypes.multilingual has test isolation issues. #12

Closed
tisto opened this issue Apr 21, 2015 · 4 comments
Closed

archetypes.multilingual has test isolation issues. #12

tisto opened this issue Apr 21, 2015 · 4 comments

Comments

@tisto
Copy link
Member

tisto commented Apr 21, 2015

  1. Add archetypes.multilingual to AT_plone_app_testing alltests group in buildout.coredev tests.cfg
  2. Run buildout
  3. Run alltests-at
    => Test failures
$ bin/alltests-at --group=AT_plone_app_testing
#### Running tests for group AT_plone_app_testing ####
Running Products.CMFDynamicViewFTI.tests.CMFDVFTITestCase.CMFDynamicViewFTI Testing:Functional tests:
  Set up plone.testing.zca.LayerCleanup in 0.000 seconds.
  Set up plone.testing.z2.Startup in 0.206 seconds.
  Set up plone.app.testing.layers.PloneFixture in 6.639 seconds.
  Set up plone.app.testing.bbb.PloneTestCaseFixture in 1.026 seconds.
  Set up Products.CMFDynamicViewFTI.tests.CMFDVFTITestCase.PloneTestCaseFixture in 0.119 seconds.
  Set up Products.CMFDynamicViewFTI.tests.CMFDVFTITestCase.CMFDynamicViewFTI Testing:Functional in 0.000 seconds.
  Running:

  Ran 34 tests with 0 failures, 0 errors, 0 skipped in 2.007 seconds.
Running Products.contentmigration.tests.layer.PloneContentMigrationTestCase:Functional tests:
  Tear down Products.CMFDynamicViewFTI.tests.CMFDVFTITestCase.CMFDynamicViewFTI Testing:Functional in 0.000 seconds.
  Tear down Products.CMFDynamicViewFTI.tests.CMFDVFTITestCase.PloneTestCaseFixture in 0.002 seconds.
  Set up Products.contentmigration.tests.layer.PloneTestCaseFixture in 0.666 seconds.
  Set up Products.contentmigration.tests.layer.PloneContentMigrationTestCase:Functional in 0.000 seconds.
  Running:

  Ran 14 tests with 0 failures, 0 errors, 0 skipped in 2.557 seconds.
Running Testing.ZopeTestCase.layer.ZopeLite tests:
  Tear down Products.contentmigration.tests.layer.PloneContentMigrationTestCase:Functional in 0.000 seconds.
  Tear down Products.contentmigration.tests.layer.PloneTestCaseFixture in 0.005 seconds.
  Tear down plone.app.testing.bbb.PloneTestCaseFixture in 0.002 seconds.
  Tear down plone.app.testing.layers.PloneFixture in 0.021 seconds.
  Tear down plone.testing.z2.Startup in 0.002 seconds.
  Tear down plone.testing.zca.LayerCleanup in 0.001 seconds.
  Set up Testing.ZopeTestCase.layer.ZopeLite in 0.005 seconds.
  Running:

  Ran 5 tests with 0 failures, 0 errors, 0 skipped in 0.007 seconds.
Running archetypes.multilingual.testing.archetypes.multilingual:Functional tests:
  Tear down Testing.ZopeTestCase.layer.ZopeLite in 0.000 seconds.
  Set up plone.testing.zca.LayerCleanup in 0.000 seconds.
  Set up plone.testing.z2.Startup in 0.047 seconds.
  Set up plone.app.testing.layers.PloneFixture in 4.047 seconds.
  Set up plone.app.contenttypes.testing.PloneAppContenttypesMigration in 0.841 seconds.
  Set up archetypes.multilingual.testing.ArchetypesMultilingualLayer in 0.402 seconds.
  Set up archetypes.multilingual.testing.archetypes.multilingual:Functional in 0.000 seconds.
  Running:
    2/2 (100.0%)

Error in test test_monkey_non_folderish (archetypes.multilingual.tests.test_monkey.TestLanguageMonkeyPatch)
Traceback (most recent call last):
  File "/home/timo/.buildout/eggs/unittest2-0.5.1-py2.7.egg/unittest2/case.py", line 340, in run
    testMethod()
  File "/home/timo/.buildout/eggs/archetypes.multilingual-3.0-py2.7.egg/archetypes/multilingual/tests/test_monkey.py", line 39, in test_monkey_non_folderish
    folder = makeContent(self.portal, 'Folder', id='folder')
  File "/home/timo/.buildout/eggs/archetypes.multilingual-3.0-py2.7.egg/archetypes/multilingual/tests/utils.py", line 7, in makeContent
    _createObjectByType(type_name, context, id=id, **kwargs)
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/Products.CMFPlone/Products/CMFPlone/utils.py", line 342, in _createObjectByType
    return fti._constructInstance(container, id, *args, **kw)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/TypesTool.py", line 552, in _constructInstance
    newid = m(id, *args, **kw)
  File "<string>", line 4, in addATFolder
  File "/home/timo/.buildout/eggs/Zope2-2.13.22-py2.7.egg/OFS/ObjectManager.py", line 326, in _setObject
    v = self._checkId(id)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/Skinnable.py", line 213, in _checkId
    return superCheckId(self, id, allow_dup)
  File "/home/timo/.buildout/eggs/Zope2-2.13.22-py2.7.egg/OFS/ObjectManager.py", line 116, in checkValidId
    'The id "%s" is invalid - it is already in use.' % id)
BadRequest: The id "folder" is invalid - it is already in use.


  Ran 2 tests with 0 failures, 1 errors, 0 skipped in 2.601 seconds.
Running archetypes.multilingual.testing.archetypes.multilingual:Integration tests:
  Tear down archetypes.multilingual.testing.archetypes.multilingual:Functional in 0.000 seconds.
  Set up archetypes.multilingual.testing.archetypes.multilingual:Integration in 0.000 seconds.
  Running:

  Ran 8 tests with 0 failures, 0 errors, 0 skipped in 1.189 seconds.
Running plone.app.collection.testing.PloneAppCollectionLayer:Integration tests:
  Tear down archetypes.multilingual.testing.archetypes.multilingual:Integration in 0.000 seconds.
  Tear down archetypes.multilingual.testing.ArchetypesMultilingualLayer in 0.003 seconds.
  Tear down plone.app.contenttypes.testing.PloneAppContenttypesMigration in 0.003 seconds.
  Set up plone.app.collection.testing.PloneAppCollectionLayer Traceback (most recent call last):
  File "/home/timo/.buildout/eggs/zope.testrunner-4.4.4-py2.7.egg/zope/testrunner/runner.py", line 400, in run_layer
    setup_layer(options, layer, setup_layers)
  File "/home/timo/.buildout/eggs/zope.testrunner-4.4.4-py2.7.egg/zope/testrunner/runner.py", line 708, in setup_layer
    setup_layer(options, base, setup_layers)
  File "/home/timo/.buildout/eggs/zope.testrunner-4.4.4-py2.7.egg/zope/testrunner/runner.py", line 713, in setup_layer
    layer.setUp()
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/plone.app.testing/plone/app/testing/helpers.py", line 350, in setUp
    self.setUpPloneSite(portal)
  File "/home/timo/.buildout/eggs/plone.app.collection-1.1.3-py2.7.egg/plone/app/collection/testing.py", line 44, in setUpPloneSite
    title=u"Test Folder"
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/PortalFolder.py", line 292, in invokeFactory
    return pt.constructContent(type_name, self, id, RESPONSE, *args, **kw)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/TypesTool.py", line 833, in constructContent
    ob = info.constructInstance(container, id, *args, **kw)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/TypesTool.py", line 311, in constructInstance
    return self._constructInstance(container, id, *args, **kw)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/TypesTool.py", line 559, in _constructInstance
    notify(ObjectAddedEvent(obj, container, newid))
  File "/home/timo/.buildout/eggs/zope.event-3.5.2-py2.7.egg/zope/event/__init__.py", line 31, in notify
    subscriber(event)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/event.py", line 24, in dispatch
    zope.component.subscribers(event, None)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 136, in subscribers
    return sitemanager.subscribers(objects, interface)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/registry.py", line 321, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/usr/lib/python2.7/dist-packages/zope/interface/adapter.py", line 601, in subscribers
    subscription(*objects)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/event.py", line 32, in objectEventNotify
    zope.component.subscribers((event.object, event), None)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 136, in subscribers
    return sitemanager.subscribers(objects, interface)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/registry.py", line 321, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/usr/lib/python2.7/dist-packages/zope/interface/adapter.py", line 601, in subscribers
    subscription(*objects)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/CMFCatalogAware.py", line 262, in handleContentishEvent
    ob.notifyWorkflowCreated()
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/CMFCatalogAware.py", line 188, in notifyWorkflowCreated
    wftool.notifyCreated(self)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/WorkflowTool.py", line 289, in notifyCreated
    self._reindexWorkflowVariables(ob)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/WorkflowTool.py", line 635, in _reindexWorkflowVariables
    ob.reindexObject(idxs=vars)
  File "/home/timo/.buildout/eggs/Products.Archetypes-1.10.6-py2.7.egg/Products/Archetypes/CatalogMultiplex.py", line 120, in reindexObject
    c.catalog_object(self, url, idxs=lst)
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/Products.CMFPlone/Products/CMFPlone/CatalogTool.py", line 340, in catalog_object
    update_metadata, pghandler=pghandler)
  File "/home/timo/.buildout/eggs/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/ZCatalog.py", line 476, in catalog_object
    update_metadata=update_metadata)
  File "/home/timo/.buildout/eggs/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/Catalog.py", line 341, in catalogObject
    index = self.updateMetadata(object, uid, None)
  File "/home/timo/.buildout/eggs/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/Catalog.py", line 292, in updateMetadata
    newDataRecord = self.recordify(object)
  File "/home/timo/.buildout/eggs/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/Catalog.py", line 413, in recordify
    attr = getattr(object, x, MV)
  File "/home/timo/.buildout/eggs/plone.indexer-1.0.2-py2.7.egg/plone/indexer/wrapper.py", line 65, in __getattr__
    return indexer()
  File "/home/timo/.buildout/eggs/plone.indexer-1.0.2-py2.7.egg/plone/indexer/delegate.py", line 18, in __call__
    return self.callable(self.context)
  File "/home/timo/.buildout/eggs/plone.app.multilingual-3.0.0-py2.7.egg/plone/app/multilingual/indexer.py", line 15, in LanguageIndexer
    language = ILanguage(object).get_language()
TypeError: ('Could not adapt', <Acquisition.ImplicitAcquisitionWrapper object at 0x7efdefcd76e0>, <InterfaceClass Products.CMFPlone.interfaces.language.ILanguage>)

Running plone.app.testing.bbb.PloneTestCase:Functional tests:
  Set up plone.app.testing.bbb.PloneTestCaseFixture Traceback (most recent call last):
  File "/home/timo/.buildout/eggs/zope.testrunner-4.4.4-py2.7.egg/zope/testrunner/runner.py", line 400, in run_layer
    setup_layer(options, layer, setup_layers)
  File "/home/timo/.buildout/eggs/zope.testrunner-4.4.4-py2.7.egg/zope/testrunner/runner.py", line 708, in setup_layer
    setup_layer(options, base, setup_layers)
  File "/home/timo/.buildout/eggs/zope.testrunner-4.4.4-py2.7.egg/zope/testrunner/runner.py", line 713, in setup_layer
    layer.setUp()
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/plone.app.testing/plone/app/testing/helpers.py", line 350, in setUp
    self.setUpPloneSite(portal)
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/plone.app.testing/plone/app/testing/bbb.py", line 42, in setUpPloneSite
    testing.applyProfile(portal, 'Products.ATContentTypes:content')
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/plone.app.testing/plone/app/testing/helpers.py", line 120, in applyProfile
    blacklisted_steps=blacklisted_steps)
  File "/home/timo/.buildout/eggs/Products.GenericSetup-1.7.5-py2.7.egg/Products/GenericSetup/tool.py", line 365, in runAllImportStepsFromProfile
    blacklisted_steps=blacklisted_steps)
   - __traceback_info__: profile-Products.ATContentTypes:content
  File "/home/timo/.buildout/eggs/Products.GenericSetup-1.7.5-py2.7.egg/Products/GenericSetup/tool.py", line 1119, in _runImportStepsFromContext
    message = self._doRunImportStep(step, context)
  File "/home/timo/.buildout/eggs/Products.GenericSetup-1.7.5-py2.7.egg/Products/GenericSetup/tool.py", line 1030, in _doRunImportStep
    return handler(context)
   - __traceback_info__: atct_content
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/Products.ATContentTypes/Products/ATContentTypes/setuphandlers.py", line 297, in importContent
    setupPortalContent(site)
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/Products.ATContentTypes/Products/ATContentTypes/setuphandlers.py", line 106, in setupPortalContent
    title=front_title, description=front_desc)
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/Products.CMFPlone/Products/CMFPlone/utils.py", line 342, in _createObjectByType
    return fti._constructInstance(container, id, *args, **kw)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/TypesTool.py", line 559, in _constructInstance
    notify(ObjectAddedEvent(obj, container, newid))
  File "/home/timo/.buildout/eggs/zope.event-3.5.2-py2.7.egg/zope/event/__init__.py", line 31, in notify
    subscriber(event)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/event.py", line 24, in dispatch
    zope.component.subscribers(event, None)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 136, in subscribers
    return sitemanager.subscribers(objects, interface)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/registry.py", line 321, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/usr/lib/python2.7/dist-packages/zope/interface/adapter.py", line 601, in subscribers
    subscription(*objects)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/event.py", line 32, in objectEventNotify
    zope.component.subscribers((event.object, event), None)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 136, in subscribers
    return sitemanager.subscribers(objects, interface)
  File "/home/timo/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/registry.py", line 321, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/usr/lib/python2.7/dist-packages/zope/interface/adapter.py", line 601, in subscribers
    subscription(*objects)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/CMFCatalogAware.py", line 262, in handleContentishEvent
    ob.notifyWorkflowCreated()
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/CMFCatalogAware.py", line 188, in notifyWorkflowCreated
    wftool.notifyCreated(self)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/WorkflowTool.py", line 289, in notifyCreated
    self._reindexWorkflowVariables(ob)
  File "/home/timo/.buildout/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/WorkflowTool.py", line 635, in _reindexWorkflowVariables
    ob.reindexObject(idxs=vars)
  File "/home/timo/.buildout/eggs/Products.Archetypes-1.10.6-py2.7.egg/Products/Archetypes/CatalogMultiplex.py", line 120, in reindexObject
    c.catalog_object(self, url, idxs=lst)
  File "/home/timo/workspace/plone/buildout.coredev-5.0/src/Products.CMFPlone/Products/CMFPlone/CatalogTool.py", line 340, in catalog_object
    update_metadata, pghandler=pghandler)
  File "/home/timo/.buildout/eggs/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/ZCatalog.py", line 476, in catalog_object
    update_metadata=update_metadata)
  File "/home/timo/.buildout/eggs/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/Catalog.py", line 341, in catalogObject
    index = self.updateMetadata(object, uid, None)
  File "/home/timo/.buildout/eggs/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/Catalog.py", line 292, in updateMetadata
    newDataRecord = self.recordify(object)
  File "/home/timo/.buildout/eggs/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/Catalog.py", line 413, in recordify
    attr = getattr(object, x, MV)
  File "/home/timo/.buildout/eggs/plone.indexer-1.0.2-py2.7.egg/plone/indexer/wrapper.py", line 65, in __getattr__
    return indexer()
  File "/home/timo/.buildout/eggs/plone.indexer-1.0.2-py2.7.egg/plone/indexer/delegate.py", line 18, in __call__
    return self.callable(self.context)
  File "/home/timo/.buildout/eggs/plone.app.multilingual-3.0.0-py2.7.egg/plone/app/multilingual/indexer.py", line 15, in LanguageIndexer
    language = ILanguage(object).get_language()
TypeError: ('Could not adapt', <Acquisition.ImplicitAcquisitionWrapper object at 0x7efdecdaea00>, <InterfaceClass Products.CMFPlone.interfaces.language.ILanguage>)

Tearing down left over layers:
  Tear down plone.app.testing.layers.PloneFixture in 0.019 seconds.
  Tear down plone.testing.z2.Startup in 0.002 seconds.
  Tear down plone.testing.zca.LayerCleanup in 0.002 seconds.
Total: 63 tests, 0 failures, 3 errors, 0 skipped in 24.928 seconds.
#### Finished tests for group AT_plone_app_testing ####

Packages with test failures:

Failing tests in group AT_plone_app_testing

Total time elapsed: 28.302 seconds

Grand total: 3 packages, 1 failures
@gforcada
Copy link
Member

I see that there are some transaction.commits() on that file https://github.com/plone/archetypes.multilingual/blob/master/archetypes/multilingual/tests/test_monkey.py maybe is due to that?

@tisto
Copy link
Member Author

tisto commented Apr 21, 2015

Transaction commits are ok as long as you use a functional test fixture.

@do3cc
Copy link
Member

do3cc commented Feb 17, 2016

plone/plone.testing#19
http://jenkins.plone.org/job/pull-request-5.0/902/console
the commits are not in functional test fixtures

mister-roboto pushed a commit to plone/buildout.coredev that referenced this issue Feb 18, 2016
Branch: refs/heads/master
Date: 2016-02-18T07:47:32+01:00
Author: Gil Forcada Codinachs (gforcada) <gil.forcada@freitag.de>
Commit: plone/archetypes.multilingual@19e4544

Remove transaction commit

Its use on an integration test is forbidden, due to test isolation breakage.

@bloodbare these last lines are actually not testing anything, are they needed?

Fixes:
plone/archetypes.multilingual#12

Files changed:
M archetypes/multilingual/tests/languageindependentfields.txt
Repository: archetypes.multilingual
Branch: refs/heads/master
Date: 2016-02-18T22:51:50+01:00
Author: Gil Forcada Codinachs (gforcada) <gil.forcada@freitag.de>
Commit: plone/archetypes.multilingual@b27959a

Merge pull request #20 from plone/gforcada-patch-1

Remove transaction commit

Files changed:
M archetypes/multilingual/tests/languageindependentfields.txt
gforcada added a commit to plone/buildout.coredev that referenced this issue Feb 18, 2016
The test isolation problems should be gone.

Ref:
plone/archetypes.multilingual#12
@gforcada
Copy link
Member

@tisto finally one more test isolation fixed :-)

@do3cc great job at exposing the root cause and making it obvious where to look at!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants