[Checkins] SVN: Zope/trunk/src/ Use actual deprecation as used for the other Five refactorings and move a test next to its new code

Hanno Schlichting hannosch at hannosch.eu
Tue Mar 30 17:31:53 EDT 2010


Log message for revision 110340:
  Use actual deprecation as used for the other Five refactorings and move a test next to its new code
  

Changed:
  U   Zope/trunk/src/Products/Five/schema.py
  D   Zope/trunk/src/Products/Five/tests/test_schema.py
  U   Zope/trunk/src/Products/Five/zcml.py
  A   Zope/trunk/src/Zope2/App/tests/test_schema.py

-=-
Modified: Zope/trunk/src/Products/Five/schema.py
===================================================================
--- Zope/trunk/src/Products/Five/schema.py	2010-03-30 21:14:23 UTC (rev 110339)
+++ Zope/trunk/src/Products/Five/schema.py	2010-03-30 21:31:53 UTC (rev 110340)
@@ -1,3 +1,7 @@
 # BBB
 
-from Zope2.App.schema import Zope2VocabularyRegistry
+from zope.deferredimport import deprecated
+
+deprecated("Please import from Zope2.App.schema",
+    Zope2VocabularyRegistry = 'Zope2.App.schema:Zope2VocabularyRegistry',
+)

Deleted: Zope/trunk/src/Products/Five/tests/test_schema.py
===================================================================
--- Zope/trunk/src/Products/Five/tests/test_schema.py	2010-03-30 21:14:23 UTC (rev 110339)
+++ Zope/trunk/src/Products/Five/tests/test_schema.py	2010-03-30 21:31:53 UTC (rev 110340)
@@ -1,54 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" Unit tests for Products.Five.schema module.
-
-$Id: tests.py 71093 2006-11-07 13:54:29Z yuppie $
-"""
-import unittest
-from zope.testing.cleanup import CleanUp
-
-class Zope2VocabularyRegistryTests(unittest.TestCase, CleanUp):
-
-    def _getTargetClass(self):
-        from Products.Five.schema import Zope2VocabularyRegistry
-        return Zope2VocabularyRegistry
-
-    def _makeOne(self):
-        return self._getTargetClass()()
-
-    def test_class_conforms_to_IVocabularyRegistry(self):
-        from zope.interface.verify import verifyClass
-        from zope.schema.interfaces import IVocabularyRegistry
-        verifyClass(IVocabularyRegistry, self._getTargetClass())
-
-    def test_instance_conforms_to_IVocabularyRegistry(self):
-        from zope.interface.verify import verifyObject
-        from zope.schema.interfaces import IVocabularyRegistry
-        verifyObject(IVocabularyRegistry, self._makeOne())
-
-    def test_get_miss_raises_LookupError(self):
-        registry = self._makeOne()
-        context = object()
-        self.assertRaises(LookupError, registry.get, context, 'nonesuch')
-
-    def test_get_hit_finds_registered_IVocabularyFactory(self):
-        from zope.component import provideUtility
-        from zope.schema.interfaces import IVocabularyFactory
-        _marker = object()
-        def _factory(context):
-            return _marker
-        provideUtility(_factory, IVocabularyFactory, 'foundit')
-        registry = self._makeOne()
-        context = object()
-        found = registry.get(context, 'foundit')
-        self.failUnless(found is _marker)

Modified: Zope/trunk/src/Products/Five/zcml.py
===================================================================
--- Zope/trunk/src/Products/Five/zcml.py	2010-03-30 21:14:23 UTC (rev 110339)
+++ Zope/trunk/src/Products/Five/zcml.py	2010-03-30 21:31:53 UTC (rev 110340)
@@ -1,9 +1,12 @@
 # BBB
 
-from Zope2.App.zcml import _context
-from Zope2.App.zcml import _initialized
+from zope.deferredimport import deprecated
 
-from Zope2.App.zcml import load_site
-from Zope2.App.zcml import load_config
-from Zope2.App.zcml import load_string
-from Zope2.App.zcml import cleanUp
+deprecated("Please import from Zope2.App.zcml",
+    _context = 'Zope2.App.zcml:_context',
+    _initialized = 'Zope2.App.zcml:_initialized',
+    cleanUp = 'Zope2.App.zcml:cleanUp',
+    load_config = 'Zope2.App.zcml:load_config',
+    load_site = 'Zope2.App.zcml:load_site',
+    load_string = 'Zope2.App.zcml:load_string',
+)

Copied: Zope/trunk/src/Zope2/App/tests/test_schema.py (from rev 110303, Zope/trunk/src/Products/Five/tests/test_schema.py)
===================================================================
--- Zope/trunk/src/Zope2/App/tests/test_schema.py	                        (rev 0)
+++ Zope/trunk/src/Zope2/App/tests/test_schema.py	2010-03-30 21:31:53 UTC (rev 110340)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing.cleanup import CleanUp
+
+
+class Zope2VocabularyRegistryTests(unittest.TestCase, CleanUp):
+
+    def _getTargetClass(self):
+        from ..schema import Zope2VocabularyRegistry
+        return Zope2VocabularyRegistry
+
+    def _makeOne(self):
+        return self._getTargetClass()()
+
+    def test_class_conforms_to_IVocabularyRegistry(self):
+        from zope.interface.verify import verifyClass
+        from zope.schema.interfaces import IVocabularyRegistry
+        verifyClass(IVocabularyRegistry, self._getTargetClass())
+
+    def test_instance_conforms_to_IVocabularyRegistry(self):
+        from zope.interface.verify import verifyObject
+        from zope.schema.interfaces import IVocabularyRegistry
+        verifyObject(IVocabularyRegistry, self._makeOne())
+
+    def test_get_miss_raises_LookupError(self):
+        registry = self._makeOne()
+        context = object()
+        self.assertRaises(LookupError, registry.get, context, 'nonesuch')
+
+    def test_get_hit_finds_registered_IVocabularyFactory(self):
+        from zope.component import provideUtility
+        from zope.schema.interfaces import IVocabularyFactory
+        _marker = object()
+        def _factory(context):
+            return _marker
+        provideUtility(_factory, IVocabularyFactory, 'foundit')
+        registry = self._makeOne()
+        context = object()
+        found = registry.get(context, 'foundit')
+        self.failUnless(found is _marker)



More information about the checkins mailing list