[Checkins] SVN: zope.location/trunk/ Convert last remaining doctest.

Tres Seaver cvs-admin at zope.org
Thu Jun 7 02:31:24 UTC 2012


Log message for revision 126654:
  Convert last remaining doctest.
  

Changed:
  _U  zope.location/trunk/
  D   zope.location/trunk/src/zope/location/configure.txt
  U   zope.location/trunk/src/zope/location/tests/test_doctests.py

-=-
Deleted: zope.location/trunk/src/zope/location/configure.txt
===================================================================
--- zope.location/trunk/src/zope/location/configure.txt	2012-06-07 01:32:32 UTC (rev 126653)
+++ zope.location/trunk/src/zope/location/configure.txt	2012-06-07 02:31:16 UTC (rev 126654)
@@ -1,14 +0,0 @@
-Package configuration
-=====================
-
-The ``zope.location`` package provides a ZCML file that configures some
-location-related adapters. As we don't have ``zope.copy`` available in our
-test environment, three adapters get registered:
-
-  >>> from zope.configuration.xmlconfig import XMLConfig
-  >>> import zope.location
-
-  >>> XMLConfig('configure.zcml', zope.location)()
-
-  >>> len(list(zope.component.getGlobalSiteManager().registeredAdapters()))
-  3

Modified: zope.location/trunk/src/zope/location/tests/test_doctests.py
===================================================================
--- zope.location/trunk/src/zope/location/tests/test_doctests.py	2012-06-07 01:32:32 UTC (rev 126653)
+++ zope.location/trunk/src/zope/location/tests/test_doctests.py	2012-06-07 02:31:16 UTC (rev 126654)
@@ -11,20 +11,30 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Location support tests
+"""Test ZCML loading
 """
-
-import doctest
 import unittest
 
+class Test_ZCML_loads(unittest.TestCase):
 
+    def test_it(self):
+        try:
+            from zope.configuration.xmlconfig import _clearContext
+            from zope.configuration.xmlconfig import _getContext
+            from zope.configuration.xmlconfig import XMLConfig
+        except ImportError:
+            pass
+        else:
+            import zope.location
+            _clearContext()
+            context = _getContext()
+            XMLConfig('configure.zcml', zope.location)
+            adapters = ([x for x in context.actions
+                            if x['discriminator'] is not None])
+            self.assertEqual(len(adapters), 4)
+        
+
 def test_suite():
-    suite = unittest.TestSuite()
-    try:
-        import zope.configuration
-    except ImportError:
-        pass
-    else:
-        suite.addTest(doctest.DocFileSuite('../configure.txt'))
-
-    return suite
+    return unittest.TestSuite((
+        unittest.makeSuite(Test_ZCML_loads),
+    ))



More information about the checkins mailing list