[CMF-checkins] SVN: CMF/branches/yuppie-catalog_setup-redo/ fixed
unit tests:
Yvo Schubbe
y.2005- at wcm-solutions.de
Wed Sep 28 15:58:13 EDT 2005
Log message for revision 38669:
fixed unit tests:
- PlacelessSetup tests clear registered adapters, so all tests using adapters have to load the zcml explicitly
- Five.testing moved to Five.tests.testing
Changed:
U CMF/branches/yuppie-catalog_setup-redo/CMFCore/tests/fiveactions.zcml
U CMF/branches/yuppie-catalog_setup-redo/CMFCore/tests/test_fiveactionstool.py
U CMF/branches/yuppie-catalog_setup-redo/CMFSetup/tests/test_catalog.py
U CMF/branches/yuppie-catalog_setup-redo/GenericSetup/PluginIndexes/tests/test_adapters.py
U CMF/branches/yuppie-catalog_setup-redo/GenericSetup/ZCTextIndex/tests/test_adapters.py
U CMF/branches/yuppie-catalog_setup-redo/GenericSetup/ZCatalog/tests/test_adapters.py
-=-
Modified: CMF/branches/yuppie-catalog_setup-redo/CMFCore/tests/fiveactions.zcml
===================================================================
--- CMF/branches/yuppie-catalog_setup-redo/CMFCore/tests/fiveactions.zcml 2005-09-28 18:49:20 UTC (rev 38668)
+++ CMF/branches/yuppie-catalog_setup-redo/CMFCore/tests/fiveactions.zcml 2005-09-28 19:58:12 UTC (rev 38669)
@@ -9,7 +9,7 @@
title="CMF menu" />
<browser:menuItem
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
menu="mymenu"
title="Public Test Menu Item"
action="public.html"
@@ -18,7 +18,7 @@
/>
<browser:menuItem
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
menu="mymenu"
title="Protected Test Menu Item"
action="protected.html"
Modified: CMF/branches/yuppie-catalog_setup-redo/CMFCore/tests/test_fiveactionstool.py
===================================================================
--- CMF/branches/yuppie-catalog_setup-redo/CMFCore/tests/test_fiveactionstool.py 2005-09-28 18:49:20 UTC (rev 38668)
+++ CMF/branches/yuppie-catalog_setup-redo/CMFCore/tests/test_fiveactionstool.py 2005-09-28 19:58:12 UTC (rev 38669)
@@ -45,7 +45,7 @@
Let's create some simple content object providing ISimpleContent:
- >>> from Products.Five.testing.simplecontent import SimpleContent
+ >>> from Products.Five.tests.testing.simplecontent import SimpleContent
>>> foo = SimpleContent('foo', 'Foo')
Now we'll load a configuration file specifying some menu and menu
Modified: CMF/branches/yuppie-catalog_setup-redo/CMFSetup/tests/test_catalog.py
===================================================================
--- CMF/branches/yuppie-catalog_setup-redo/CMFSetup/tests/test_catalog.py 2005-09-28 18:49:20 UTC (rev 38668)
+++ CMF/branches/yuppie-catalog_setup-redo/CMFSetup/tests/test_catalog.py 2005-09-28 19:58:12 UTC (rev 38669)
@@ -17,14 +17,15 @@
import unittest
import Testing
-import Zope2
-Zope2.startup()
+import Products
from OFS.Folder import Folder
+from Products.Five import zcml
from Products.ZCTextIndex.Lexicon import CaseNormalizer
from Products.ZCTextIndex.Lexicon import Splitter
from Products.ZCTextIndex.Lexicon import StopWordRemover
from Products.ZCTextIndex.ZCTextIndex import PLexicon
+from zope.app.tests.placelesssetup import PlacelessSetup
from Products.CMFCore.CatalogTool import CatalogTool
@@ -38,7 +39,7 @@
pass
-class _CatalogToolSetup(BaseRegistryTests):
+class _CatalogToolSetup(PlacelessSetup, BaseRegistryTests):
def _initSite(self, foo=2):
site = self.root.site = Folder(id='site')
@@ -65,7 +66,19 @@
return site
+ def setUp(self):
+ PlacelessSetup.setUp(self)
+ BaseRegistryTests.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+ zcml.load_config('configure.zcml', Products.GenericSetup.ZCatalog)
+ zcml.load_config('configure.zcml', Products.GenericSetup.ZCTextIndex)
+ def tearDown(self):
+ BaseRegistryTests.tearDown(self)
+ PlacelessSetup.tearDown(self)
+
_EMPTY_EXPORT = """\
<?xml version="1.0"?>
<object meta_type="CMF Catalog" name="portal_catalog">
Modified: CMF/branches/yuppie-catalog_setup-redo/GenericSetup/PluginIndexes/tests/test_adapters.py
===================================================================
--- CMF/branches/yuppie-catalog_setup-redo/GenericSetup/PluginIndexes/tests/test_adapters.py 2005-09-28 18:49:20 UTC (rev 38668)
+++ CMF/branches/yuppie-catalog_setup-redo/GenericSetup/PluginIndexes/tests/test_adapters.py 2005-09-28 19:58:12 UTC (rev 38669)
@@ -17,10 +17,12 @@
import unittest
import Testing
-import Zope2
-Zope2.startup()
+import Products.Five
+import Products.GenericSetup.PluginIndexes
+from Products.Five import zcml
from Products.GenericSetup.testing import NodeAdapterTestCase
+from zope.app.tests.placelesssetup import PlacelessSetup
_DATE_XML = """\
@@ -70,7 +72,7 @@
"""
-class DateIndexNodeAdapterTests(NodeAdapterTestCase):
+class DateIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -81,11 +83,16 @@
def setUp(self):
from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = DateIndex('foo_date')
self._XML = _DATE_XML
-class DateRangeIndexNodeAdapterTests(NodeAdapterTestCase):
+class DateRangeIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -100,11 +107,16 @@
from Products.PluginIndexes.DateRangeIndex.DateRangeIndex \
import DateRangeIndex
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = DateRangeIndex('foo_daterange')
self._XML = _DATERANGE_XML
-class FieldIndexNodeAdapterTests(NodeAdapterTestCase):
+class FieldIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -118,11 +130,16 @@
def setUp(self):
from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = FieldIndex('foo_field')
self._XML = _FIELD_XML
-class KeywordIndexNodeAdapterTests(NodeAdapterTestCase):
+class KeywordIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -137,11 +154,17 @@
from Products.PluginIndexes.KeywordIndex.KeywordIndex \
import KeywordIndex
+
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = KeywordIndex('foo_keyword')
self._XML = _KEYWORD_XML
-class PathIndexNodeAdapterTests(NodeAdapterTestCase):
+class PathIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -152,11 +175,17 @@
def setUp(self):
from Products.PluginIndexes.PathIndex.PathIndex import PathIndex
+
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = PathIndex('foo_path')
self._XML = _PATH_XML
-class VocabularyNodeAdapterTests(NodeAdapterTestCase):
+class VocabularyNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -167,6 +196,11 @@
def setUp(self):
from Products.PluginIndexes.TextIndex.Vocabulary import Vocabulary
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = Vocabulary('foo_vocabulary')
self._XML = _VOCABULARY_XML
@@ -174,7 +208,7 @@
pass
-class TextIndexNodeAdapterTests(NodeAdapterTestCase):
+class TextIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -185,6 +219,11 @@
def setUp(self):
from Products.PluginIndexes.TextIndex.TextIndex import TextIndex
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = TextIndex('foo_text')
self._XML = _TEXT_XML
@@ -192,7 +231,7 @@
pass
-class FilteredSetNodeAdapterTests(NodeAdapterTestCase):
+class FilteredSetNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -207,11 +246,16 @@
from Products.PluginIndexes.TopicIndex.FilteredSet \
import PythonFilteredSet
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = PythonFilteredSet('bar', '')
self._XML = _SET_XML
-class TopicIndexNodeAdapterTests(NodeAdapterTestCase):
+class TopicIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.adapters \
@@ -226,6 +270,11 @@
def setUp(self):
from Products.PluginIndexes.TopicIndex.TopicIndex import TopicIndex
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+
self._obj = TopicIndex('foo_topic')
self._XML = _TOPIC_XML
Modified: CMF/branches/yuppie-catalog_setup-redo/GenericSetup/ZCTextIndex/tests/test_adapters.py
===================================================================
--- CMF/branches/yuppie-catalog_setup-redo/GenericSetup/ZCTextIndex/tests/test_adapters.py 2005-09-28 18:49:20 UTC (rev 38668)
+++ CMF/branches/yuppie-catalog_setup-redo/GenericSetup/ZCTextIndex/tests/test_adapters.py 2005-09-28 19:58:12 UTC (rev 38669)
@@ -17,12 +17,14 @@
import unittest
import Testing
-import Zope2
-Zope2.startup()
from Acquisition import Implicit
+import Products.Five
+import Products.GenericSetup.ZCTextIndex
+from Products.Five import zcml
from Products.GenericSetup.testing import NodeAdapterTestCase
+from zope.app.tests.placelesssetup import PlacelessSetup
class _extra:
@@ -52,7 +54,7 @@
"""
-class ZCLexiconNodeAdapterTests(NodeAdapterTestCase):
+class ZCLexiconNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.ZCTextIndex.adapters \
@@ -69,11 +71,15 @@
def setUp(self):
from Products.ZCTextIndex.ZCTextIndex import PLexicon
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.GenericSetup.ZCTextIndex)
+
self._obj = PLexicon('foo_plexicon')
self._XML = _PLEXICON_XML
-class ZCTextIndexNodeAdapterTests(NodeAdapterTestCase):
+class ZCTextIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.ZCTextIndex.adapters \
@@ -85,6 +91,10 @@
from Products.ZCTextIndex.ZCTextIndex import PLexicon
from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.GenericSetup.ZCTextIndex)
+
catalog = DummyCatalog()
catalog.foo_plexicon = PLexicon('foo_plexicon')
extra = _extra()
Modified: CMF/branches/yuppie-catalog_setup-redo/GenericSetup/ZCatalog/tests/test_adapters.py
===================================================================
--- CMF/branches/yuppie-catalog_setup-redo/GenericSetup/ZCatalog/tests/test_adapters.py 2005-09-28 18:49:20 UTC (rev 38668)
+++ CMF/branches/yuppie-catalog_setup-redo/GenericSetup/ZCatalog/tests/test_adapters.py 2005-09-28 19:58:12 UTC (rev 38669)
@@ -20,9 +20,12 @@
import Zope2
Zope2.startup()
+import Products
+from Products.Five import zcml
from Products.GenericSetup.interfaces import INodeExporter
from Products.GenericSetup.testing import NodeAdapterTestCase
from Products.GenericSetup.utils import PrettyDocument
+from zope.app.tests.placelesssetup import PlacelessSetup
class _extra:
@@ -73,7 +76,7 @@
"""
-class ZCatalogNodeAdapterTests(NodeAdapterTestCase):
+class ZCatalogNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.ZCatalog.adapters \
@@ -130,6 +133,13 @@
def setUp(self):
from Products.ZCatalog.ZCatalog import ZCatalog
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PluginIndexes)
+ zcml.load_config('configure.zcml', Products.GenericSetup.ZCatalog)
+ zcml.load_config('configure.zcml', Products.GenericSetup.ZCTextIndex)
+
self._obj = ZCatalog('foo_catalog')
self._XML = _CATALOG_XML % ('', '')
More information about the CMF-checkins
mailing list