[Checkins] SVN: zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/ Add a test and a fix for bug 177733, that was causing ZopeVersion to report an unknown version when running on a machine with a locale different than english

Lorenzo Gil lgs at sicem.biz
Thu May 1 03:37:07 EDT 2008


Log message for revision 85956:
  Add a test and a fix for bug 177733, that was causing ZopeVersion to report an unknown version when running on a machine with a locale different than english

Changed:
  U   zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/tests/test_zopeversion.py
  U   zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/zopeversion.py

-=-
Modified: zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/tests/test_zopeversion.py
===================================================================
--- zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/tests/test_zopeversion.py	2008-05-01 07:00:36 UTC (rev 85955)
+++ zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/tests/test_zopeversion.py	2008-05-01 07:37:07 UTC (rev 85956)
@@ -17,6 +17,7 @@
 """
 import os
 import shutil
+import subprocess
 import tempfile
 import unittest
 
@@ -25,6 +26,14 @@
 from zope.app.applicationcontrol.zopeversion import ZopeVersion
 
 
+def isSVNAvailable():
+    try:
+        proc = subprocess.Popen('svn help', shell=True, stdout=subprocess.PIPE)
+    except OSError:
+        return False
+    else:
+        return proc.wait() == 0
+
 class MockZopeVersion(ZopeVersion):
 
     def setSVNInfoOutput(self, lines):
@@ -112,6 +121,14 @@
         self.assertEqual(self.zopeVersion.getZopeVersion(),
             "Development/Revision: 10000")
 
+    def test_WrongLocale(self):
+        """Demonstrate bug 177733"""
+        if isSVNAvailable():
+            currentPath = os.path.dirname(os.path.abspath(__file__))
+            zv = ZopeVersion(currentPath)
+            zv.getZopeVersion()
+            # check that we don't get a 'Development/Unknown' version
+            self.assert_(zv.result.startswith('Development/Revision: '))
 
 def test_suite():
     return unittest.makeSuite(Test)

Modified: zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/zopeversion.py
===================================================================
--- zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/zopeversion.py	2008-05-01 07:00:36 UTC (rev 85955)
+++ zope.app.applicationcontrol/trunk/src/zope/app/applicationcontrol/zopeversion.py	2008-05-01 07:37:07 UTC (rev 85956)
@@ -63,7 +63,7 @@
     def _getSVNInfoOutput(self):
         try:
             proc = subprocess.Popen('svn info "%s"' % self.path,
-                shell=True, stdout=subprocess.PIPE)
+                shell=True, stdout=subprocess.PIPE, env={'LANG': 'C'})
         except OSError:
             pass
         else:



More information about the Checkins mailing list