[Python-checkins] r50865 - in python/trunk/Lib: test/test_uuid.py uuid.py

georg.brandl python-checkins at python.org
Thu Jul 27 18:08:15 CEST 2006


Author: georg.brandl
Date: Thu Jul 27 18:08:15 2006
New Revision: 50865

Modified:
   python/trunk/Lib/test/test_uuid.py
   python/trunk/Lib/uuid.py
Log:
Make uuid test suite pass on this box by requesting output with LC_ALL=C.



Modified: python/trunk/Lib/test/test_uuid.py
==============================================================================
--- python/trunk/Lib/test/test_uuid.py	(original)
+++ python/trunk/Lib/test/test_uuid.py	Thu Jul 27 18:08:15 2006
@@ -288,12 +288,16 @@
     def test_ifconfig_getnode(self):
         import os
         if os.name == 'posix':
-            self.check_node(uuid._ifconfig_getnode(), 'ifconfig')
+            node = uuid._ifconfig_getnode()
+            if node is not None:
+                self.check_node(node, 'ifconfig')
 
     def test_ipconfig_getnode(self):
         import os
         if os.name == 'nt':
-            self.check_node(uuid._ipconfig_getnode(), 'ipconfig')
+            node = uuid._ipconfig_getnode()
+            if node is not None:
+                self.check_node(node, 'ipconfig')
 
     def test_netbios_getnode(self):
         if importable('win32wnet') and importable('netbios'):

Modified: python/trunk/Lib/uuid.py
==============================================================================
--- python/trunk/Lib/uuid.py	(original)
+++ python/trunk/Lib/uuid.py	Thu Jul 27 18:08:15 2006
@@ -276,7 +276,10 @@
     import os
     for dir in ['', '/sbin/', '/usr/sbin']:
         try:
-            pipe = os.popen(os.path.join(dir, 'ifconfig'))
+            # LC_ALL to get English output, 2>/dev/null to
+            # prevent output on stderr
+            cmd = 'LC_ALL=C %s 2>/dev/null' % os.path.join(dir, 'ifconfig')
+            pipe = os.popen(cmd)
         except IOError:
             continue
         for line in pipe:


More information about the Python-checkins mailing list