[Python-checkins] cpython (2.7): Issue #19804: The test_find_mac test in test_uuid is now skipped if the

serhiy.storchaka python-checkins at python.org
Fri Jan 10 14:11:38 CET 2014


http://hg.python.org/cpython/rev/34ae4333d3bf
changeset:   88391:34ae4333d3bf
branch:      2.7
parent:      88387:aee672ba9c38
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Jan 10 15:05:27 2014 +0200
summary:
  Issue #19804: The test_find_mac test in test_uuid is now skipped if the
ifconfig executable is not available.

files:
  Lib/test/test_uuid.py |  11 +++++++++++
  Misc/NEWS             |   3 +++
  2 files changed, 14 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py
--- a/Lib/test/test_uuid.py
+++ b/Lib/test/test_uuid.py
@@ -358,6 +358,17 @@
         def mock_popen(cmd):
             return io.BytesIO(data)
 
+        path = os.environ.get("PATH", os.defpath).split(os.pathsep)
+        path.extend(('/sbin', '/usr/sbin'))
+        for dir in path:
+            executable = os.path.join(dir, 'ifconfig')
+            if (os.path.exists(executable) and
+                os.access(executable, os.F_OK | os.X_OK) and
+                not os.path.isdir(executable)):
+                break
+        else:
+            self.skipTest('requires ifconfig')
+
         with test_support.swap_attr(os, 'popen', mock_popen):
             mac = uuid._find_mac(
                 command='ifconfig',
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -161,6 +161,9 @@
 Tests
 -----
 
+- Issue #19804: The test_find_mac test in test_uuid is now skipped if the
+  ifconfig executable is not available.
+
 - Issue #19886: Use better estimated memory requirements for bigmem tests.
 
 - Backported tests for Tkinter variables.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list