]> granicus.if.org Git - python/commitdiff
Issue #19804: The test_find_mac test in test_uuid is now skipped if the
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 10 Jan 2014 13:05:27 +0000 (15:05 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 10 Jan 2014 13:05:27 +0000 (15:05 +0200)
ifconfig executable is not available.

Lib/test/test_uuid.py
Misc/NEWS

index e623417af078aed1ee1acfe320e41ef96f7d3539..5ba68451912a4f6112442a18dae0c00739889a84 100644 (file)
@@ -358,6 +358,17 @@ eth0      Link encap:Ethernet  HWaddr 12:34:56:78:90:ab
         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',
index 5999b111f7b6f9455b5494790040a0a464f2599a..ddcf535fd874912bb67ad22d6030cd2efa215bb9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -161,6 +161,9 @@ IDLE
 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.