Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f11d0f

Browse files
Issue python#19804: The test_find_mac test in test_uuid is now skipped if the
ifconfig executable is not available.
1 parent c9da089 commit 0f11d0f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Lib/test/test_uuid.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,17 @@ def test_find_mac(self):
358358
def mock_popen(cmd):
359359
return io.BytesIO(data)
360360

361+
path = os.environ.get("PATH", os.defpath).split(os.pathsep)
362+
path.extend(('/sbin', '/usr/sbin'))
363+
for dir in path:
364+
executable = os.path.join(dir, 'ifconfig')
365+
if (os.path.exists(executable) and
366+
os.access(executable, os.F_OK | os.X_OK) and
367+
not os.path.isdir(executable)):
368+
break
369+
else:
370+
self.skipTest('requires ifconfig')
371+
361372
with test_support.swap_attr(os, 'popen', mock_popen):
362373
mac = uuid._find_mac(
363374
command='ifconfig',

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ IDLE
161161
Tests
162162
-----
163163

164+
- Issue #19804: The test_find_mac test in test_uuid is now skipped if the
165+
ifconfig executable is not available.
166+
164167
- Issue #19886: Use better estimated memory requirements for bigmem tests.
165168

166169
- Backported tests for Tkinter variables.

0 commit comments

Comments
 (0)