[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/ Fixed issue #334: Failing RuntimeInfo tests

Dmitry Vasiliev dima at hlabs.spb.ru
Fri Apr 8 07:52:30 EDT 2005


Log message for revision 29906:
  Fixed issue #334: Failing RuntimeInfo tests
  

Changed:
  U   Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/runtimeinfo.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py

-=-
Modified: Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt
===================================================================
--- Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt	2005-04-08 11:01:39 UTC (rev 29905)
+++ Zope3/branches/ZopeX3-3.0/doc/CHANGES.txt	2005-04-08 11:52:29 UTC (rev 29906)
@@ -10,11 +10,13 @@
 
     Bug Fixes
 
+      - Fixed issue 334 (Failing RuntimeInfo tests).
+
       - Fixed issue 293 (sequence widget).
 
       - Backported several bug fixes made to the DSN parser, including issue
         304.
-      
+
       - Contents/contents.pt didn't quote the values that were used in
         href:s, thus it couldn't function properly if the items contained
         certain characters.
@@ -34,7 +36,7 @@
     Much thanks to everyone who contributed to this release:
 
       Jim Fulton, Stephan Richter, Bjorn Tillenius,
-      Philipp von Weitershausen
+      Philipp von Weitershausen, Dmitry Vasiliev
 
       Note: If you are not listed and contributed, please add yourself. This
       note will be deleted before the release.

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/runtimeinfo.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/runtimeinfo.py	2005-04-08 11:01:39 UTC (rev 29905)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/runtimeinfo.py	2005-04-08 11:52:29 UTC (rev 29906)
@@ -24,6 +24,8 @@
 except ImportError:
     locale = None
 
+import platform
+
 from zope.app.applicationcontrol.interfaces import \
      IRuntimeInfo, IApplicationControl, IZopeVersion
 from zope.component import getUtility, ComponentLookupError
@@ -71,12 +73,15 @@
 
     def getSystemPlatform(self):
         """See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
-        # FIXME: platform.platform()?
-        if hasattr(os, "uname"):
-            info = os.uname()
-        else:
-            info = (sys.platform,)
-        return unicode(" ".join(info), self.getPreferredEncoding())
+        info = []
+        enc = self.getPreferredEncoding()
+        for item in platform.uname():
+            try:
+                t = unicode(item, enc)
+            except ValueError:
+                continue
+            info.append(t)
+        return u" ".join(info)
 
     def getCommandLine(self):
         """See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py	2005-04-08 11:01:39 UTC (rev 29905)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py	2005-04-08 11:52:29 UTC (rev 29906)
@@ -92,12 +92,7 @@
 
     def test_SystemPlatform(self):
         runtime_info = self._Test__new()
-        test_platform = (sys.platform,)
-        if hasattr(os, "uname"):
-            test_platform = os.uname()
-        enc = self._getPreferredEncoding()
-        self.assertEqual(runtime_info.getSystemPlatform(),
-                unicode(" ".join(test_platform), enc))
+        self.failUnless(runtime_info.getSystemPlatform())
 
     def test_CommandLine(self):
         runtime_info = self._Test__new()



More information about the Zope3-Checkins mailing list