Log message for revision 94532: Make the 'Cannot open version.txt' case testable.
Changed: U Zope/trunk/lib/python/App/tests/test_version_txt.py U Zope/trunk/lib/python/App/version_txt.py -=- Modified: Zope/trunk/lib/python/App/tests/test_version_txt.py =================================================================== --- Zope/trunk/lib/python/App/tests/test_version_txt.py 2009-01-05 10:57:16 UTC (rev 94531) +++ Zope/trunk/lib/python/App/tests/test_version_txt.py 2009-01-05 11:36:02 UTC (rev 94532) @@ -31,6 +31,7 @@ def _resetModuleGlobals(self): from App import version_txt + version_txt._filename = 'version.txt' version_txt._version_file = None version_txt._version_string = None version_txt._zope_version = None @@ -45,7 +46,9 @@ os.close(f) def test_without_version_txt(self): + from App import version_txt from App.version_txt import getZopeVersion + version_txt._filename = '' self.assertEqual(getZopeVersion(), (-1, -1, -1, '', -1)) def test_with_version_txt_final(self): Modified: Zope/trunk/lib/python/App/version_txt.py =================================================================== --- Zope/trunk/lib/python/App/version_txt.py 2009-01-05 10:57:16 UTC (rev 94531) +++ Zope/trunk/lib/python/App/version_txt.py 2009-01-05 11:36:02 UTC (rev 94532) @@ -17,16 +17,19 @@ import os import re import sys +import Zope2 +_location = os.path.dirname(Zope2.__file__) +_filename = 'version.txt' + _version_file = None _version_string = None _zope_version = None def _get_filename(): - import Zope2 if _version_file is not None: return _version_file - return os.path.join(os.path.dirname(Zope2.__file__), 'version.txt') + return os.path.join(_location, _filename) def _prep_version_data(): global _version_string, _zope_version _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins