[Checkins] SVN: zope.configuration/branches/tseaver-test_cleanup/s Full coverage for z.c.name.resolve.

Tres Seaver cvs-admin at zope.org
Wed May 9 23:46:45 UTC 2012


Log message for revision 125798:
  Full coverage for z.c.name.resolve.

Changed:
  U   zope.configuration/branches/tseaver-test_cleanup/setup.cfg
  A   zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/notyet.py
  A   zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/samplepackage/NamedForClass.py
  U   zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_name.py

-=-
Modified: zope.configuration/branches/tseaver-test_cleanup/setup.cfg
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/setup.cfg	2012-05-09 23:46:37 UTC (rev 125797)
+++ zope.configuration/branches/tseaver-test_cleanup/setup.cfg	2012-05-09 23:46:41 UTC (rev 125798)
@@ -4,7 +4,7 @@
 cover-erase=1
 with-doctest=0
 where=src
-ignore-files=(bad|victim).py
+ignore-files=(bad|victim|notyet).py
 
 [aliases]
 dev = develop easy_install zope.configuration[testing]

Added: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/notyet.py
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/notyet.py	                        (rev 0)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/notyet.py	2012-05-09 23:46:41 UTC (rev 125798)
@@ -0,0 +1 @@
+# We don't get imported automagically

Added: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/samplepackage/NamedForClass.py
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/samplepackage/NamedForClass.py	                        (rev 0)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/samplepackage/NamedForClass.py	2012-05-09 23:46:41 UTC (rev 125798)
@@ -0,0 +1,3 @@
+# Test the "repeat" feature of zope.configuration.name.resolve.
+class NamedForClass(object):
+    pass

Modified: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_name.py
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_name.py	2012-05-09 23:46:37 UTC (rev 125797)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_name.py	2012-05-09 23:46:41 UTC (rev 125798)
@@ -22,7 +22,49 @@
         from zope.configuration.name import resolve
         return resolve(*args, **kw)
 
+    def test_top_level_module(self):
+        import os
+        self.assertTrue(self._callFUT('os') is os)
 
+    def test_nested_module(self):
+        import os.path
+        self.assertTrue(self._callFUT('os.path') is os.path)
+
+    def test_function_in_module(self):
+        import os.path
+        self.assertTrue(self._callFUT('os.path.join') is os.path.join)
+
+    def test_importable_but_not_attr_of_parent(self):
+        import sys
+        import zope.configuration.tests as zct
+        self.assertFalse('notyet' in zct.__dict__)
+        mod = self._callFUT('zope.configuration.tests.notyet')
+        self.assertTrue(mod is zct.notyet)
+        del zct.notyet
+        del sys.modules['zope.configuration.tests.notyet']
+
+    def test_function_in_module_relative(self):
+        import os.path
+        self.assertTrue(self._callFUT('.join', 'os.path') is os.path.join)
+
+    def test_class_in_module(self):
+        from zope.configuration.tests.directives import Complex
+        self.assertTrue(
+            self._callFUT('zope.configuration.tests.directives.Complex')
+                    is Complex)
+
+    def test_class_w_same_name_as_module(self):
+        from zope.configuration.tests.samplepackage.NamedForClass \
+            import NamedForClass
+        self.assertTrue(
+            self._callFUT(
+                'zope.configuration.tests.samplepackage.NamedForClass+')
+                    is NamedForClass)
+        self.assertTrue(
+            self._callFUT(
+                'zope.configuration.tests.samplepackage.NamedForClass.')
+                    is NamedForClass)
+
 class Test_getNormalizedName(unittest.TestCase):
 
     def _callFUT(self, *args, **kw):



More information about the checkins mailing list