[Zope3-checkins] CVS: Zope3/src/zope/configuration/tests - bad.py:1.1 victim.py:1.1 test_config.py:1.3

Jim Fulton jim@zope.com
Tue, 29 Jul 2003 16:39:46 -0400


Update of /cvs-repository/Zope3/src/zope/configuration/tests
In directory cvs.zope.org:/tmp/cvs-serv23451/src/zope/configuration/tests

Modified Files:
	test_config.py 
Added Files:
	bad.py victim.py 
Log Message:
Improved the error reporting for import failures to:

- Include the original import error. This may point to a module
  imported by the module whose name is given to resolve.

- Include the original traceback, so that it's easier to diagnose
  what went wrong.



=== Added File Zope3/src/zope/configuration/tests/bad.py ===
# I'm bad. I want to be bad. Don't try to change me.

import bad_to_the_bone


=== Added File Zope3/src/zope/configuration/tests/victim.py ===
import bad


=== Zope3/src/zope/configuration/tests/test_config.py 1.2 => 1.3 ===
--- Zope3/src/zope/configuration/tests/test_config.py:1.2	Tue Jul 29 15:56:45 2003
+++ Zope3/src/zope/configuration/tests/test_config.py	Tue Jul 29 16:39:40 2003
@@ -246,6 +246,19 @@
     ValueError: The given name is blank
     """
 
+def test_bad_import():
+    """Dotted names are no longer allowed to end in dots
+
+    >>> c = config.ConfigurationContext()
+
+    >>> c.resolve('zope.configuration.tests.victim.x')
+    Traceback (most recent call last):
+    ...
+    ConfigurationError: Couldn't import zope.configuration.tests.victim,""" \
+                                       """ No module named bad_to_the_bone
+    """
+    
+
 
 def test_suite():
     return unittest.TestSuite((