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

Florent Xicluna <[email protected]>
Newsgroups gmane.comp.web.zope.zope3.cvs
Message-ID <20071203100657.E080F203B83__39284.6905896024$1196676442$gmane$org@mail.zope.org>
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():
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.