mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-40501: Replace ctypes code in uuid with native module (GH-19948)
This commit is contained in:
parent
f453221c8b
commit
d6b727e2c9
9 changed files with 248 additions and 186 deletions
|
@ -852,17 +852,6 @@ eth0 Link encap:Ethernet HWaddr 12:34:56:78:90:ab
|
|||
node = self.uuid._netstat_getnode()
|
||||
self.check_node(node, 'netstat')
|
||||
|
||||
@unittest.skipUnless(os.name == 'nt', 'requires Windows')
|
||||
def test_ipconfig_getnode(self):
|
||||
node = self.uuid._ipconfig_getnode()
|
||||
self.check_node(node, 'ipconfig')
|
||||
|
||||
@unittest.skipUnless(importable('win32wnet'), 'requires win32wnet')
|
||||
@unittest.skipUnless(importable('netbios'), 'requires netbios')
|
||||
def test_netbios_getnode(self):
|
||||
node = self.uuid._netbios_getnode()
|
||||
self.check_node(node)
|
||||
|
||||
def test_random_getnode(self):
|
||||
node = self.uuid._random_getnode()
|
||||
# The multicast bit, i.e. the least significant bit of first octet,
|
||||
|
@ -874,6 +863,13 @@ eth0 Link encap:Ethernet HWaddr 12:34:56:78:90:ab
|
|||
node2 = self.uuid._random_getnode()
|
||||
self.assertNotEqual(node2, node, '%012x' % node)
|
||||
|
||||
class TestInternalsWithoutExtModule(BaseTestInternals, unittest.TestCase):
|
||||
uuid = py_uuid
|
||||
|
||||
@unittest.skipUnless(c_uuid, 'requires the C _uuid module')
|
||||
class TestInternalsWithExtModule(BaseTestInternals, unittest.TestCase):
|
||||
uuid = c_uuid
|
||||
|
||||
@unittest.skipUnless(os.name == 'posix', 'requires Posix')
|
||||
def test_unix_getnode(self):
|
||||
if not importable('_uuid') and not importable('ctypes'):
|
||||
|
@ -885,19 +881,10 @@ eth0 Link encap:Ethernet HWaddr 12:34:56:78:90:ab
|
|||
self.check_node(node, 'unix')
|
||||
|
||||
@unittest.skipUnless(os.name == 'nt', 'requires Windows')
|
||||
@unittest.skipUnless(importable('ctypes'), 'requires ctypes')
|
||||
def test_windll_getnode(self):
|
||||
node = self.uuid._windll_getnode()
|
||||
self.check_node(node)
|
||||
|
||||
|
||||
class TestInternalsWithoutExtModule(BaseTestInternals, unittest.TestCase):
|
||||
uuid = py_uuid
|
||||
|
||||
@unittest.skipUnless(c_uuid, 'requires the C _uuid module')
|
||||
class TestInternalsWithExtModule(BaseTestInternals, unittest.TestCase):
|
||||
uuid = c_uuid
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue