Back to index

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

Classes

class  DocXMLRPCHTTPGETServer

Functions

def make_request_and_skipIf
def server
def test_main

Variables

tuple threading = support.import_module('threading')
 PORT = None
 arg

Function Documentation

def test.test_docxmlrpc.make_request_and_skipIf (   condition,
  reason 
)

Definition at line 12 of file test_docxmlrpc.py.

00012 
00013 def make_request_and_skipIf(condition, reason):
00014     # If we skip the test, we have to make a request because the
00015     # the server created in setUp blocks expecting one to come in.
00016     if not condition:
00017         return lambda func: func
00018     def decorator(func):
00019         def make_request_and_skip(self):
00020             self.client.request("GET", "/")
00021             self.client.getresponse()
00022             raise unittest.SkipTest(reason)
00023         return make_request_and_skip
00024     return decorator
00025 

Here is the caller graph for this function:

def test.test_docxmlrpc.server (   evt,
  numrequests 
)

Definition at line 26 of file test_docxmlrpc.py.

00026 
00027 def server(evt, numrequests):
00028     serv = DocXMLRPCServer(("localhost", 0), logRequests=False)
00029 
00030     try:
00031         global PORT
00032         PORT = serv.socket.getsockname()[1]
00033 
00034         # Add some documentation
00035         serv.set_server_title("DocXMLRPCServer Test Documentation")
00036         serv.set_server_name("DocXMLRPCServer Test Docs")
00037         serv.set_server_documentation(
00038             "This is an XML-RPC server's documentation, but the server "
00039             "can be used by POSTing to /RPC2. Try self.add, too.")
00040 
00041         # Create and register classes and functions
00042         class TestClass(object):
00043             def test_method(self, arg):
00044                 """Test method's docs. This method truly does very little."""
00045                 self.arg = arg
00046 
00047         serv.register_introspection_functions()
00048         serv.register_instance(TestClass())
00049 
00050         def add(x, y):
00051             """Add two instances together. This follows PEP008, but has nothing
00052             to do with RFC1952. Case should matter: pEp008 and rFC1952.  Things
00053             that start with http and ftp should be auto-linked, too:
00054             http://google.com.
00055             """
00056             return x + y
00057 
00058         serv.register_function(add)
00059         serv.register_function(lambda x, y: x-y)
00060 
00061         while numrequests > 0:
00062             serv.handle_request()
00063             numrequests -= 1
00064     except socket.timeout:
00065         pass
00066     finally:
00067         serv.server_close()
00068         PORT = None
00069         evt.set()

Definition at line 194 of file test_docxmlrpc.py.

00194 
00195 def test_main():
00196     support.run_unittest(DocXMLRPCHTTPGETServer)


Variable Documentation

Definition at line 44 of file test_docxmlrpc.py.

Definition at line 10 of file test_docxmlrpc.py.

Definition at line 5 of file test_docxmlrpc.py.