plone/plone.app.versioningbehavior — pull request #8 by jone (2014-06-22 12:39:57+00:00)
Title: Use plone.app.testing

I've refactored some tests to use plone.app.testing.

There are still the tests inheriting from CMFEditions tests, though, which are still based on Products.PloneTestCase.

In this state the inherited CMFEditions tests (`test_Integration`) cause testing isolation problems on later running p.a.testing tests.
My suspicition is that the PloneTestCase setup changes something with the transaction handling.

```python
Running Products.PloneTestCase.layer.PloneSite tests:
Set up Testing.ZopeTestCase.layer.ZopeLite in 0.587 seconds.
Set up Products.PloneTestCase.layer.ZCML in 3.329 seconds.
Set up Products.PloneTestCase.layer.PloneSite in 4.081 seconds.
Ran 32 tests with 0 failures and 0 errors in 10.434 seconds.
Running plone.app.versioningbehavior.testing.plone.app.versioningbehavior:functional tests:
Tear down Products.PloneTestCase.layer.PloneSite in 0.091 seconds.
Tear down Products.PloneTestCase.layer.ZCML in 0.004 seconds.
Tear down Testing.ZopeTestCase.layer.ZopeLite in 0.000 seconds.
Set up plone.testing.zca.LayerCleanup in 0.001 seconds.
Set up plone.testing.z2.Startup in 0.077 seconds.
Set up plone.app.testing.layers.PloneFixtureCould not install product Products.CMFPlacefulWorkflow
Could not install product plonetheme.barceloneta
in 4.237 seconds.
Set up plone.app.versioningbehavior.testing.VersioningLayer in 0.233 seconds.
Set up plone.app.versioningbehavior.testing.plone.app.versioningbehavior:functional in 0.000 seconds.

Error in test test_version_view (plone.app.versioningbehavior.tests.test_functional.FunctionalTestCase)
Traceback (most recent call last):
File "/Users/jone/projects/python/cache/eggs/unittest2-0.5.1-py2.7.egg/unittest2/case.py", line 333, in run
self.setUp()
File "/Users/jone/projects/packages/plone.app.versioningbehavior/plone/app/versioningbehavior/tests/test_functional.py", line 33, in setUp
text=u'Object 1 some footext.',
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/PortalFolder.py", line 292, in invokeFactory
return pt.constructContent(type_name, self, id, RESPONSE, *args, **kw)
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/TypesTool.py", line 833, in constructContent
ob = info.constructInstance(container, id, *args, **kw)
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/TypesTool.py", line 311, in constructInstance
return self._constructInstance(container, id, *args, **kw)
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/TypesTool.py", line 569, in _constructInstance
rval = container._setObject(id, obj)
File "/Users/jone/projects/python/cache/eggs/Zope2-2.13.22-py2.7.egg/OFS/ObjectManager.py", line 326, in _setObject
v = self._checkId(id)
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/Skinnable.py", line 210, in _checkId
return superCheckId(self, id, allow_dup)
File "/Users/jone/projects/python/cache/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 "obj1" is invalid - it is already in use.

Error in test test_versions_history_form_should_work_with_dexterity_content (plone.app.versioningbehavior.tests.test_functional.FunctionalTestCase)
Traceback (most recent call last):
File "/Users/jone/projects/python/cache/eggs/unittest2-0.5.1-py2.7.egg/unittest2/case.py", line 333, in run
self.setUp()
File "/Users/jone/projects/packages/plone.app.versioningbehavior/plone/app/versioningbehavior/tests/test_functional.py", line 33, in setUp
text=u'Object 1 some footext.',
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/PortalFolder.py", line 292, in invokeFactory
return pt.constructContent(type_name, self, id, RESPONSE, *args, **kw)
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/TypesTool.py", line 833, in constructContent
ob = info.constructInstance(container, id, *args, **kw)
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/TypesTool.py", line 311, in constructInstance
return self._constructInstance(container, id, *args, **kw)
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/TypesTool.py", line 569, in _constructInstance
rval = container._setObject(id, obj)
File "/Users/jone/projects/python/cache/eggs/Zope2-2.13.22-py2.7.egg/OFS/ObjectManager.py", line 326, in _setObject
v = self._checkId(id)
File "/Users/jone/projects/python/cache/eggs/Products.CMFCore-2.2.7-py2.7.egg/Products/CMFCore/Skinnable.py", line 210, in _checkId
return superCheckId(self, id, allow_dup)
File "/Users/jone/projects/python/cache/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 "obj1" is invalid - it is already in use.

Ran 5 tests with 0 failures and 2 errors in 11.360 seconds.
Tearing down left over layers:
Tear down plone.app.versioningbehavior.testing.plone.app.versioningbehavior:functional in 0.000 seconds.
Tear down plone.app.versioningbehavior.testing.VersioningLayer in 0.003 seconds.
Tear down plone.app.testing.layers.PloneFixture in 0.071 seconds.
Tear down plone.testing.z2.Startup in 0.006 seconds.
Tear down plone.testing.zca.LayerCleanup in 0.002 seconds.
Total: 37 tests, 0 failures, 2 errors in 34.870 seconds.
```

When running only the p.a.testing layer, the currently failing tests pass.

@tisto any idea what could cause those issues?
I could work around them (e.g. by removing some objects in tear down) but this should be handled by the ZODB / transaction isolation mechanism, I guess.