[issue32107] test_uuid uses the incorrect bitmask

Barry A. Warsaw report at bugs.python.org
Tue Nov 21 15:24:55 EST 2017


Barry A. Warsaw <barry at python.org> added the comment:

Yikes.  It's entirely possible that these tests are tainted by environmental leakage.  I was looking into why Travis fails on my PR:

https://travis-ci.org/python/cpython/jobs/305433725

and stepping through _ifconfig_getnode() on my Mac.  The "ibridge" interface is getting returned, which has a MAC address of:

>>> from uuid import _ifconfig_getnode
>>> mac = _ifconfig_getnode()
>>> hex(mac)
'0xacde48001122'

That's for the en5 interface, which according to this article is the bridge to the Touch Bar, and *the same on every Mac*.

https://discussions.apple.com/thread/7763102?start=0&tstart=0

Why I think that's problematic for this particular test is that whatever gets returned is going to be highly dependent on the hardware the test is run on, and it's entirely possible that the MAC address returned is indeed locally administered and not tied to a physical external (and thus required to be universally administered) MAC address.

Mocking _ifconfig_*() probably isn't a good idea because these tests are worthless that way.  But it's also true that the _ifconfig_*() methods can match unexpected interfaces which cause the test to fail incorrectly.  It's a mess, and I'm not sure what to do about it.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32107>
_______________________________________


More information about the Python-bugs-list mailing list