summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-05-29 21:02:37 (GMT)
committerSteve Dower <steve.dower@python.org>2019-05-29 21:02:37 (GMT)
commit8f96c9f8ed2a4795e34b333411451e24f28f74d2 (patch)
tree0f87bcc9b18f6d6c907bd040e0bc9af794a155ba /Lib
parentfecb75c1bb46c818e6579ba422cfa5d0d9d104d1 (diff)
downloadcpython-8f96c9f8ed2a4795e34b333411451e24f28f74d2.zip
cpython-8f96c9f8ed2a4795e34b333411451e24f28f74d2.tar.gz
cpython-8f96c9f8ed2a4795e34b333411451e24f28f74d2.tar.bz2
bpo-37007: Implement socket.if_nametoindex(), if_indextoname() and if_nameindex() on Windows (GH-13522)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_socket.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 0094cec..74662cf 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -973,16 +973,18 @@ class GeneralModuleTests(unittest.TestCase):
self.assertIsInstance(_name, str)
self.assertEqual(name, _name)
- @unittest.skipUnless(hasattr(socket, 'if_nameindex'),
- 'socket.if_nameindex() not available.')
- def testInvalidInterfaceNameIndex(self):
- # test nonexistent interface index/name
+ @unittest.skipUnless(hasattr(socket, 'if_indextoname'),
+ 'socket.if_indextoname() not available.')
+ def testInvalidInterfaceIndexToName(self):
self.assertRaises(OSError, socket.if_indextoname, 0)
- self.assertRaises(OSError, socket.if_nametoindex, '_DEADBEEF')
- # test with invalid values
- self.assertRaises(TypeError, socket.if_nametoindex, 0)
self.assertRaises(TypeError, socket.if_indextoname, '_DEADBEEF')
+ @unittest.skipUnless(hasattr(socket, 'if_nametoindex'),
+ 'socket.if_nametoindex() not available.')
+ def testInvalidInterfaceNameToIndex(self):
+ self.assertRaises(TypeError, socket.if_nametoindex, 0)
+ self.assertRaises(OSError, socket.if_nametoindex, '_DEADBEEF')
+
@unittest.skipUnless(hasattr(sys, 'getrefcount'),
'test needs sys.getrefcount()')
def testRefCountGetNameInfo(self):
@@ -1638,9 +1640,7 @@ class GeneralModuleTests(unittest.TestCase):
self.assertEqual(sockaddr, ('ff02::1de:c0:face:8d', 1234, 0, 0))
@unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.')
- @unittest.skipUnless(
- hasattr(socket, 'if_nameindex'),
- 'if_nameindex is not supported')
+ @unittest.skipIf(sys.platform == 'win32', 'does not work on Windows')
@unittest.skipIf(AIX, 'Symbolic scope id does not work')
def test_getaddrinfo_ipv6_scopeid_symbolic(self):
# Just pick up any network interface (Linux, Mac OS X)
@@ -1672,9 +1672,7 @@ class GeneralModuleTests(unittest.TestCase):
self.assertEqual(sockaddr, ('ff02::1de:c0:face:8d', 1234, 0, ifindex))
@unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.')
- @unittest.skipUnless(
- hasattr(socket, 'if_nameindex'),
- 'if_nameindex is not supported')
+ @unittest.skipIf(sys.platform == 'win32', 'does not work on Windows')
@unittest.skipIf(AIX, 'Symbolic scope id does not work')
def test_getnameinfo_ipv6_scopeid_symbolic(self):
# Just pick up any network interface.