Back to index

python3.2  3.2.2
Public Member Functions
test.test_socket.NonblockConstantTest Class Reference

List of all members.

Public Member Functions

def checkNonblock
def test_SOCK_NONBLOCK

Detailed Description

Definition at line 1990 of file test_socket.py.


Member Function Documentation

def test.test_socket.NonblockConstantTest.checkNonblock (   self,
  s,
  nonblock = True,
  timeout = 0.0 
)

Definition at line 1991 of file test_socket.py.

01991 
01992     def checkNonblock(self, s, nonblock=True, timeout=0.0):
01993         if nonblock:
01994             self.assertTrue(s.type & socket.SOCK_NONBLOCK)
01995             self.assertEqual(s.gettimeout(), timeout)
01996         else:
01997             self.assertFalse(s.type & socket.SOCK_NONBLOCK)
01998             self.assertEqual(s.gettimeout(), None)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1999 of file test_socket.py.

01999 
02000     def test_SOCK_NONBLOCK(self):
02001         v = linux_version()
02002         if v < (2, 6, 28):
02003             self.skipTest("Linux kernel 2.6.28 or higher required, not %s"
02004                           % ".".join(map(str, v)))
02005         # a lot of it seems silly and redundant, but I wanted to test that
02006         # changing back and forth worked ok
02007         with socket.socket(socket.AF_INET,
02008                            socket.SOCK_STREAM | socket.SOCK_NONBLOCK) as s:
02009             self.checkNonblock(s)
02010             s.setblocking(1)
02011             self.checkNonblock(s, False)
02012             s.setblocking(0)
02013             self.checkNonblock(s)
02014             s.settimeout(None)
02015             self.checkNonblock(s, False)
02016             s.settimeout(2.0)
02017             self.checkNonblock(s, timeout=2.0)
02018             s.setblocking(1)
02019             self.checkNonblock(s, False)
02020         # defaulttimeout
02021         t = socket.getdefaulttimeout()
02022         socket.setdefaulttimeout(0.0)
02023         with socket.socket() as s:
02024             self.checkNonblock(s)
02025         socket.setdefaulttimeout(None)
02026         with socket.socket() as s:
02027             self.checkNonblock(s, False)
02028         socket.setdefaulttimeout(2.0)
02029         with socket.socket() as s:
02030             self.checkNonblock(s, timeout=2.0)
02031         socket.setdefaulttimeout(None)
02032         with socket.socket() as s:
02033             self.checkNonblock(s, False)
02034         socket.setdefaulttimeout(t)
02035 

Here is the call graph for this function:


The documentation for this class was generated from the following file: