Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_socketserver Namespace Reference

Classes

class  ForkingUnixStreamServer
class  ForkingUnixDatagramServer
class  SocketServerTest

Functions

def signal_alarm
def receive
def simple_subprocess
def test_main

Variables

 threading = None
string TEST_STR = "hello world\n"
 HOST = test.support.HOST
tuple HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX")
tuple HAVE_FORKING = hasattr(os, "fork")

Detailed Description

Test suite for socketserver.

Function Documentation

def test.test_socketserver.receive (   sock,
  n,
  timeout = 20 
)

Definition at line 35 of file test_socketserver.py.

00035 
00036 def receive(sock, n, timeout=20):
00037     r, w, x = select.select([sock], [], [], timeout)
00038     if sock in r:
00039         return sock.recv(n)
00040     else:
00041         raise RuntimeError("timed out on %r" % (sock,))

Here is the caller graph for this function:

Call signal.alarm when it exists (i.e. not on Windows).

Definition at line 30 of file test_socketserver.py.

00030 
00031 def signal_alarm(n):
00032     """Call signal.alarm when it exists (i.e. not on Windows)."""
00033     if hasattr(signal, 'alarm'):
00034         signal.alarm(n)

Here is the caller graph for this function:

Definition at line 53 of file test_socketserver.py.

00053 
00054 def simple_subprocess(testcase):
00055     pid = os.fork()
00056     if pid == 0:
00057         # Don't throw an exception; it would be caught by the test harness.
00058         os._exit(72)
00059     yield None
00060     pid2, status = os.waitpid(pid, 0)
00061     testcase.assertEqual(pid2, pid)
00062     testcase.assertEqual(72 << 8, status)
00063 
00064 
@unittest.skipUnless(threading, 'Threading required for this test.')

Here is the caller graph for this function:

Definition at line 277 of file test_socketserver.py.

00277 
00278 def test_main():
00279     if imp.lock_held():
00280         # If the import lock is held, the threads will hang
00281         raise unittest.SkipTest("can't run when import lock is held")
00282 
00283     test.support.run_unittest(SocketServerTest)

Here is the call graph for this function:


Variable Documentation

tuple test.test_socketserver.HAVE_FORKING = hasattr(os, "fork")

Definition at line 28 of file test_socketserver.py.

tuple test.test_socketserver.HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX")

Definition at line 27 of file test_socketserver.py.

Definition at line 25 of file test_socketserver.py.

Definition at line 24 of file test_socketserver.py.

Definition at line 20 of file test_socketserver.py.