Changeset 1685

Show
Ignore:
Timestamp:
09/15/08 20:34:35 (2 months ago)
Author:
nick
Message:

Adding license and docstrings

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pyamf/sandbox/nick/gae_client.py

    r1663 r1685  
     1# -*- encoding: utf8 -*- 
     2# 
     3# Copyright (c) 2007 The PyAMF Project. All rights reserved. 
     4#  
     5# Permission is hereby granted, free of charge, to any person obtaining 
     6# a copy of this software and associated documentation files (the 
     7# "Software"), to deal in the Software without restriction, including 
     8# without limitation the rights to use, copy, modify, merge, publish, 
     9# distribute, sublicense, and/or sell copies of the Software, and to 
     10# permit persons to whom the Software is furnished to do so, subject to 
     11# the following conditions: 
     12#  
     13# The above copyright notice and this permission notice shall be 
     14# included in all copies or substantial portions of the Software. 
     15#  
     16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
     17# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
     18# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
     19# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
     20# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
     21# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
     22# WITH THE SOFTWARE OR THE USE OR OTHER DEALI 
     23 
     24""" 
     25GAE Client - a unit test runner that operates against a running GAE Instance. 
     26This script can be used as part of an automated build (e.g. buildbot) to test 
     27the app whilst it is running on Google's infrastructure. 
     28""" 
     29 
    130import simplejson 
    231import pycurl 
    332 
    4  
    5  
    633class GAETestRunner(object): 
     34    """ 
     35    This class interfaces with the test application running on a GAE Instance. 
     36 
     37    The structure of the app is as follows: 
     38     - /tests/ - Returns a list of tests to run, in json format. There are 
     39        three keys, 'tests', 'expected', and 'skipped'. 'tests' are a list of 
     40        all the tests that should be run to complete the test suite. 'expected' 
     41        is a list of tests that are expected to fail. This means that test 
     42        suites that were built with more open environments can pass. 'skipped' 
     43        means tests that were not meant to run at all on the GAE platform. 
     44     - /run/{module}/{test_case}/{method} - Runs an individual test. The 
     45        response is a json object that contains the following keys: 'test' - 
     46        the fully qualified name of the test, 'skipped' - if C{True} then this 
     47        test was skipped, 'passed' - a boolean if the test password or not, 
     48        'errors' - a list of errors that occurred when running the test, 
     49        'failures' - a list of failures that occurred when running the test. 
     50 
     51        errors or failures generally contain the formatted traceback that was 
     52        the problem. 
     53    """ 
     54 
    755    def __init__(self, url): 
     56        """ 
     57        @param url: The fully qualified url that gives access to the test app. 
     58        @type url: C{str} 
     59        """ 
    860        if url[-1] != '/': 
    961            url += '/' 
     
    4597 
    4698    def run_test_suite(self, out): 
     99        """ 
     100        This is the workhorse function. Call this to iterate through the test 
     101        suite. It returns a dict containing varions details about the test run. 
     102 
     103        @param out: A file type object used to output a formatted version of the 
     104            test run. Very similar to Twisted's default test runner. 
     105        @return: A dict containing the following keys: 
     106         - `errors`: a dict of tests that contained errors, the key being the 
     107            full qualified test name. 
     108         - `failures`: Similar to errors. 
     109         - `skips`: A list of tests that were skipped 
     110         - `failed`: A boolean determining the outcome of the test run. 
     111         - `count`: The number of tests that were actually run. 
     112        """ 
    47113        # TODO thread this or convert to Twisted .. 
    48114