mirror of
https://github.com/python/cpython.git
synced 2025-07-29 22:24:49 +00:00
socket.ioctl is only available on Windows
This commit is contained in:
parent
aee643b01f
commit
a47b75b0a0
2 changed files with 14 additions and 1 deletions
|
@ -141,7 +141,10 @@ _socketmethods = (
|
||||||
'bind', 'connect', 'connect_ex', 'fileno', 'listen',
|
'bind', 'connect', 'connect_ex', 'fileno', 'listen',
|
||||||
'getpeername', 'getsockname', 'getsockopt', 'setsockopt',
|
'getpeername', 'getsockname', 'getsockopt', 'setsockopt',
|
||||||
'sendall', 'setblocking',
|
'sendall', 'setblocking',
|
||||||
'settimeout', 'gettimeout', 'shutdown', 'ioctl')
|
'settimeout', 'gettimeout', 'shutdown')
|
||||||
|
|
||||||
|
if os.name == "nt":
|
||||||
|
_socketmethods = _socketmethods + ('ioctl',)
|
||||||
|
|
||||||
if sys.platform == "riscos":
|
if sys.platform == "riscos":
|
||||||
_socketmethods = _socketmethods + ('sleeptaskw',)
|
_socketmethods = _socketmethods + ('sleeptaskw',)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import time
|
||||||
import thread, threading
|
import thread, threading
|
||||||
import Queue
|
import Queue
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import array
|
import array
|
||||||
from weakref import proxy
|
from weakref import proxy
|
||||||
import signal
|
import signal
|
||||||
|
@ -500,6 +501,15 @@ class GeneralModuleTests(unittest.TestCase):
|
||||||
self.assertEqual(sock.proto, 0)
|
self.assertEqual(sock.proto, 0)
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
|
def test_sock_ioctl(self):
|
||||||
|
if os.name != "nt":
|
||||||
|
return
|
||||||
|
self.assert_(hasattr(socket.socket, 'ioctl'))
|
||||||
|
self.assert_(hasattr(socket, 'SIO_RCVALL'))
|
||||||
|
self.assert_(hasattr(socket, 'RCVALL_ON'))
|
||||||
|
self.assert_(hasattr(socket, 'RCVALL_OFF'))
|
||||||
|
|
||||||
|
|
||||||
class BasicTCPTest(SocketConnectedTest):
|
class BasicTCPTest(SocketConnectedTest):
|
||||||
|
|
||||||
def __init__(self, methodName='runTest'):
|
def __init__(self, methodName='runTest'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue