[Zope-Checkins] SVN: zdaemon/trunk/src/zdaemon/tests/tests.py Fix AttributeError when running tests without .egg-info

Florent Xicluna laxyf at yahoo.fr
Mon Dec 3 05:06:58 EST 2007


Log message for revision 82089:
  Fix AttributeError when running tests without .egg-info
  

Changed:
  U   zdaemon/trunk/src/zdaemon/tests/tests.py

-=-
Modified: zdaemon/trunk/src/zdaemon/tests/tests.py
===================================================================
--- zdaemon/trunk/src/zdaemon/tests/tests.py	2007-12-03 06:27:32 UTC (rev 82088)
+++ zdaemon/trunk/src/zdaemon/tests/tests.py	2007-12-03 10:06:57 UTC (rev 82089)
@@ -18,14 +18,13 @@
 
 try:
     import pkg_resources
-except ImportError:
-    zdaemon_loc = os.path.dirname(os.path.dirname(zdaemon.__file__))
-    zconfig_loc = os.path.dirname(os.path.dirname(ZConfig.__file__))
-else:
     zdaemon_loc = pkg_resources.working_set.find(
         pkg_resources.Requirement.parse('zdaemon')).location
     zconfig_loc = pkg_resources.working_set.find(
         pkg_resources.Requirement.parse('ZConfig')).location
+except (ImportError, AttributeError):
+    zdaemon_loc = os.path.dirname(os.path.dirname(zdaemon.__file__))
+    zconfig_loc = os.path.dirname(os.path.dirname(ZConfig.__file__))
 
 
 def make_sure_non_daemon_mode_doesnt_hang_when_program_exits():



More information about the Zope-Checkins mailing list