[Zope3-checkins] SVN: Zope3/trunk/src/zope/configuration/ Collector 322: test_bad_import vs Python 2.4c1

Tim Peters tim.one at comcast.net
Fri Nov 19 18:28:20 EST 2004


Log message for revision 28480:
  Collector 322:  test_bad_import vs Python 2.4c1
  
  Reverted revisions 28420 & 28426.  Those introduced a distinction
  in ConfigurationContext.resolve() that depended on Python's long-
  time bad behavior of leaving insane module objects behind in
  sys.modules after a failing import.  Python 2.4 no longer does
  that, so the test depending on that distinction broke.
  
  The intent of the new code was fine, but it can't be achieved in
  so simple a way.
  

Changed:
  U   Zope3/trunk/src/zope/configuration/config.py
  U   Zope3/trunk/src/zope/configuration/tests/test_config.py

-=-
Modified: Zope3/trunk/src/zope/configuration/config.py
===================================================================
--- Zope3/trunk/src/zope/configuration/config.py	2004-11-19 19:11:21 UTC (rev 28479)
+++ Zope3/trunk/src/zope/configuration/config.py	2004-11-19 23:28:19 UTC (rev 28480)
@@ -178,11 +178,6 @@
         try:
             mod = __import__(mname, *_import_chickens)
         except ImportError, v:
-            if sys.modules.has_key(mname):
-                # The module was at least partially imported, so there
-                # is probably a bug in some Python code rather than a
-                # configuration error.
-                raise
             raise ConfigurationError, (
                 "Couldn't import %s, %s" % (mname, v)
                 ), sys.exc_info()[2]

Modified: Zope3/trunk/src/zope/configuration/tests/test_config.py
===================================================================
--- Zope3/trunk/src/zope/configuration/tests/test_config.py	2004-11-19 19:11:21 UTC (rev 28479)
+++ Zope3/trunk/src/zope/configuration/tests/test_config.py	2004-11-19 23:28:19 UTC (rev 28480)
@@ -255,7 +255,8 @@
     >>> c.resolve('zope.configuration.tests.victim.x')
     Traceback (most recent call last):
     ...
-    ImportError: No module named bad_to_the_bone
+    ConfigurationError: Couldn't import zope.configuration.tests.victim,""" \
+                                       """ No module named bad_to_the_bone
 
     Cleanup:
 



More information about the Zope3-Checkins mailing list