[CMF-checkins] SVN: CMF/trunk/ - small node adapter test refactoring
Yvo Schubbe
y.2005- at wcm-solutions.de
Thu Dec 1 13:20:47 EST 2005
Log message for revision 40452:
- small node adapter test refactoring
Changed:
U CMF/trunk/CMFCore/exportimport/tests/test_actions.py
U CMF/trunk/CMFCore/exportimport/tests/test_cachingpolicymgr.py
U CMF/trunk/CMFCore/exportimport/tests/test_content.py
U CMF/trunk/CMFCore/exportimport/tests/test_skins.py
U CMF/trunk/GenericSetup/PluginIndexes/tests/test_exportimport.py
U CMF/trunk/GenericSetup/ZCTextIndex/tests/test_exportimport.py
U CMF/trunk/GenericSetup/testing.py
-=-
Modified: CMF/trunk/CMFCore/exportimport/tests/test_actions.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_actions.py 2005-12-01 16:56:35 UTC (rev 40451)
+++ CMF/trunk/CMFCore/exportimport/tests/test_actions.py 2005-12-01 18:20:45 UTC (rev 40452)
@@ -245,7 +245,7 @@
self._providers = [ x for x in self._providers if x != provider_name ]
-class ActionNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class ActionNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.CMFCore.exportimport.actions import ActionNodeAdapter
@@ -274,20 +274,17 @@
self.assertEqual(obj.visible, True)
def setUp(self):
- from Products.CMFCore.ActionInformation import Action
import Products.CMFCore.exportimport
- import Products.Five
- from Products.Five import zcml
+ from Products.CMFCore.ActionInformation import Action
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
self._obj = Action('foo_action')
self._XML = _ACTION_XML
-class ActionCategoryNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class ActionCategoryNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.CMFCore.exportimport.actions \
@@ -305,13 +302,10 @@
self.assertEqual(obj.title, '')
def setUp(self):
- from Products.CMFCore.ActionInformation import ActionCategory
import Products.CMFCore.exportimport
- import Products.Five
- from Products.Five import zcml
+ from Products.CMFCore.ActionInformation import ActionCategory
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
self._obj = ActionCategory('foo_category')
Modified: CMF/trunk/CMFCore/exportimport/tests/test_cachingpolicymgr.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_cachingpolicymgr.py 2005-12-01 16:56:35 UTC (rev 40451)
+++ CMF/trunk/CMFCore/exportimport/tests/test_cachingpolicymgr.py 2005-12-01 18:20:45 UTC (rev 40452)
@@ -51,7 +51,7 @@
"""
-class CachingPolicyNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class CachingPolicyNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.CMFCore.exportimport.cachingpolicymgr \
@@ -60,13 +60,10 @@
return CachingPolicyNodeAdapter
def setUp(self):
- from Products.CMFCore.CachingPolicyManager import CachingPolicy
import Products.CMFCore.exportimport
- import Products.Five
- from Products.Five import zcml
+ from Products.CMFCore.CachingPolicyManager import CachingPolicy
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
self._obj = CachingPolicy('foo_policy', max_age_secs=0)
Modified: CMF/trunk/CMFCore/exportimport/tests/test_content.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_content.py 2005-12-01 16:56:35 UTC (rev 40451)
+++ CMF/trunk/CMFCore/exportimport/tests/test_content.py 2005-12-01 18:20:45 UTC (rev 40452)
@@ -26,7 +26,6 @@
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext
-from conformance import ConformsToIFilesystemExporter
from conformance import ConformsToIFilesystemImporter
Modified: CMF/trunk/CMFCore/exportimport/tests/test_skins.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_skins.py 2005-12-01 16:56:35 UTC (rev 40451)
+++ CMF/trunk/CMFCore/exportimport/tests/test_skins.py 2005-12-01 18:20:45 UTC (rev 40452)
@@ -261,8 +261,7 @@
DirectoryView._dirreg = self._olddirreg
-class DirectoryViewAdapterTests(_DVRegistrySetup, PlacelessSetup,
- NodeAdapterTestCase):
+class DirectoryViewAdapterTests(_DVRegistrySetup, NodeAdapterTestCase):
def _getTargetClass(self):
from Products.CMFCore.exportimport.skins \
@@ -275,12 +274,10 @@
def setUp(self):
import Products.CMFCore.exportimport
- import Products.Five
from Products.CMFCore.DirectoryView import DirectoryView
- PlacelessSetup.setUp(self)
+ NodeAdapterTestCase.setUp(self)
_DVRegistrySetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
self._obj = DirectoryView('foo_directoryview').__of__(Folder())
@@ -288,7 +285,7 @@
def tearDown(self):
_DVRegistrySetup.tearDown(self)
- PlacelessSetup.tearDown(self)
+ NodeAdapterTestCase.tearDown(self)
class SkinsToolXMLAdapterTests(_DVRegistrySetup, BodyAdapterTestCase):
@@ -323,7 +320,7 @@
def tearDown(self):
_DVRegistrySetup.tearDown(self)
- PlacelessSetup.tearDown(self)
+ BodyAdapterTestCase.tearDown(self)
class _SkinsSetup(_DVRegistrySetup, PlacelessSetup, BaseRegistryTests):
Modified: CMF/trunk/GenericSetup/PluginIndexes/tests/test_exportimport.py
===================================================================
--- CMF/trunk/GenericSetup/PluginIndexes/tests/test_exportimport.py 2005-12-01 16:56:35 UTC (rev 40451)
+++ CMF/trunk/GenericSetup/PluginIndexes/tests/test_exportimport.py 2005-12-01 18:20:45 UTC (rev 40452)
@@ -18,13 +18,9 @@
import unittest
import Testing
-import Products.Five
-import Products.GenericSetup.PluginIndexes
from Products.Five import zcml
from Products.GenericSetup.testing import NodeAdapterTestCase
-from Products.GenericSetup.testing import PlacelessSetup
-
_DATE_XML = """\
<index name="foo_date" meta_type="DateIndex">
<property name="index_naive_time_as_local">True</property>
@@ -72,7 +68,7 @@
"""
-class DateIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class DateIndexNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -81,10 +77,10 @@
return DateIndexNodeAdapter
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
@@ -92,7 +88,7 @@
self._XML = _DATE_XML
-class DateRangeIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class DateRangeIndexNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -104,11 +100,11 @@
obj._edit('bar', 'baz')
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.DateRangeIndex.DateRangeIndex \
import DateRangeIndex
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
@@ -116,7 +112,7 @@
self._XML = _DATERANGE_XML
-class FieldIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class FieldIndexNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -128,10 +124,10 @@
obj.indexed_attrs = ('bar',)
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
@@ -139,7 +135,7 @@
self._XML = _FIELD_XML
-class KeywordIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class KeywordIndexNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -151,12 +147,11 @@
obj.indexed_attrs = ('bar',)
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.KeywordIndex.KeywordIndex \
import KeywordIndex
-
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
@@ -164,7 +159,7 @@
self._XML = _KEYWORD_XML
-class PathIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class PathIndexNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -173,11 +168,10 @@
return PathIndexNodeAdapter
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.PathIndex.PathIndex import PathIndex
-
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
@@ -185,7 +179,7 @@
self._XML = _PATH_XML
-class VocabularyNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class VocabularyNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -194,10 +188,10 @@
return VocabularyNodeAdapter
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.TextIndex.Vocabulary import Vocabulary
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
@@ -208,7 +202,7 @@
pass
-class TextIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class TextIndexNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -217,10 +211,10 @@
return TextIndexNodeAdapter
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.TextIndex.TextIndex import TextIndex
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
@@ -231,7 +225,7 @@
pass
-class FilteredSetNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class FilteredSetNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -243,11 +237,11 @@
obj.setExpression('True')
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.TopicIndex.FilteredSet \
import PythonFilteredSet
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
@@ -255,7 +249,7 @@
self._XML = _SET_XML
-class TopicIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class TopicIndexNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.PluginIndexes.exportimport \
@@ -268,10 +262,10 @@
obj.addFilteredSet('baz', 'PythonFilteredSet', 'False')
def setUp(self):
+ import Products.GenericSetup.PluginIndexes
from Products.PluginIndexes.TopicIndex.TopicIndex import TopicIndex
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml',
Products.GenericSetup.PluginIndexes)
Modified: CMF/trunk/GenericSetup/ZCTextIndex/tests/test_exportimport.py
===================================================================
--- CMF/trunk/GenericSetup/ZCTextIndex/tests/test_exportimport.py 2005-12-01 16:56:35 UTC (rev 40451)
+++ CMF/trunk/GenericSetup/ZCTextIndex/tests/test_exportimport.py 2005-12-01 18:20:45 UTC (rev 40452)
@@ -20,23 +20,9 @@
from Acquisition import Implicit
-import Products.Five
-import Products.GenericSetup.ZCTextIndex
from Products.Five import zcml
from Products.GenericSetup.testing import NodeAdapterTestCase
-from Products.GenericSetup.testing import PlacelessSetup
-
-class _extra:
-
- pass
-
-
-class DummyCatalog(Implicit):
-
- pass
-
-
_PLEXICON_XML = """\
<object name="foo_plexicon" meta_type="ZCTextIndex Lexicon">
<element name="Whitespace splitter" group="Word Splitter"/>
@@ -54,8 +40,18 @@
"""
-class ZCLexiconNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class _extra:
+ pass
+
+
+class DummyCatalog(Implicit):
+
+ pass
+
+
+class ZCLexiconNodeAdapterTests(NodeAdapterTestCase):
+
def _getTargetClass(self):
from Products.GenericSetup.ZCTextIndex.exportimport \
import ZCLexiconNodeAdapter
@@ -69,17 +65,17 @@
obj._pipeline = (Splitter(), CaseNormalizer(), StopWordRemover())
def setUp(self):
+ import Products.GenericSetup.ZCTextIndex
from Products.ZCTextIndex.ZCTextIndex import PLexicon
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml', Products.GenericSetup.ZCTextIndex)
self._obj = PLexicon('foo_plexicon')
self._XML = _PLEXICON_XML
-class ZCTextIndexNodeAdapterTests(PlacelessSetup, NodeAdapterTestCase):
+class ZCTextIndexNodeAdapterTests(NodeAdapterTestCase):
def _getTargetClass(self):
from Products.GenericSetup.ZCTextIndex.exportimport \
@@ -88,11 +84,11 @@
return ZCTextIndexNodeAdapter
def setUp(self):
+ import Products.GenericSetup.ZCTextIndex
from Products.ZCTextIndex.ZCTextIndex import PLexicon
from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex
- PlacelessSetup.setUp(self)
- zcml.load_config('meta.zcml', Products.Five)
+ NodeAdapterTestCase.setUp(self)
zcml.load_config('configure.zcml', Products.GenericSetup.ZCTextIndex)
catalog = DummyCatalog()
Modified: CMF/trunk/GenericSetup/testing.py
===================================================================
--- CMF/trunk/GenericSetup/testing.py 2005-12-01 16:56:35 UTC (rev 40451)
+++ CMF/trunk/GenericSetup/testing.py 2005-12-01 18:20:45 UTC (rev 40452)
@@ -16,6 +16,8 @@
"""
import unittest
+import Testing
+
from xml.dom.minidom import parseString
import Products.Five
@@ -49,6 +51,9 @@
zcml.load_config('meta.zcml', Products.Five)
zcml.load_config('permissions.zcml', Products.Five)
+ def tearDown(self):
+ PlacelessSetup.tearDown(self)
+
def test_z3interfaces(self):
verifyClass(IBody, self._getTargetClass())
@@ -68,7 +73,7 @@
self.assertEqual(exporter.body, self._BODY)
-class NodeAdapterTestCase(unittest.TestCase):
+class NodeAdapterTestCase(PlacelessSetup, unittest.TestCase):
def _populate(self, obj):
pass
@@ -76,6 +81,14 @@
def _verifyImport(self, obj):
pass
+ def setUp(self):
+ PlacelessSetup.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
+
+ def tearDown(self):
+ PlacelessSetup.tearDown(self)
+
def test_z3interfaces(self):
verifyClass(INodeExporter, self._getTargetClass())
verifyClass(INodeImporter, self._getTargetClass())
More information about the CMF-checkins
mailing list