runTests.py :  » Business-Application » PDB2PQR » pdb2pqr-1.6 » contrib » ZSI-2.1-a1 » test » wsdl2py » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Business Application » PDB2PQR 
PDB2PQR » pdb2pqr 1.6 » contrib » ZSI 2.1 a1 » test » wsdl2py » runTests.py
#!/usr/bin/env python
############################################################################
# Joshua R. Boverhof, LBNL
# See Copyright for copyright notice!
###########################################################################
import unittest, warnings, os
from ZSI import version
from ZSI.wstools.logging import gridLog
from ServiceTest import main,CONFIG_PARSER,DOCUMENT,LITERAL,BROKE,TESTS

os.environ['GRIDLOG_ON'] = '1'
os.environ['GRIDLOG_DEST'] = "gridlog-udp://portnoy.lbl.gov:15100"

# General targets
def dispatch():
    """Run all dispatch tests"""
    return _dispatchTestSuite(broke=False)

def local():
    """Run all local tests"""
    return _localTestSuite(broke=False)
    
def net():
    """Run all network tests"""
    return _netTestSuite(broke=False)
    
def all():
    """Run all tests"""
    return _allTestSuite(broke=False)


# Specialized binding targets
def docLitTestSuite():
    """Run all doc/lit network tests"""
    return _netTestSuite(broke=False, document=True, literal=True)

def rpcLitTestSuite():
    """Run all rpc/lit network tests"""
    return _netTestSuite(broke=False, document=False, literal=True)

def rpcEncTestSuite():
    """Run all rpc/enc network tests"""
    return _netTestSuite(broke=False, document=False, literal=False)
    
    
# Low level functions
def _allTestSuite(document=None, literal=None, broke=None):
    return _makeTestSuite('all', document, literal, broke)

def _netTestSuite(document=None, literal=None, broke=None):
    return _makeTestSuite('net', document, literal, broke)

def _localTestSuite(document=None, literal=None, broke=None):
    return _makeTestSuite('local', document, literal, broke)
    
def _dispatchTestSuite(document=None, literal=None, broke=None):
    return _makeTestSuite('dispatch', document, literal, broke)

    
def _makeTestSuite(test, document=None, literal=None, broke=None):
    """Return a test suite containing all test cases that satisfy 
    the parameters. None means don't check.
    
    Parameters:
       test -- "net" run network tests, "local" run local tests,
           "dispatch" run dispatch tests, "all" run all tests.
       document -- None, True, False
       literal -- None, True, False
       broke -- None, True, False
    """
    assert test in ['net', 'local', 'dispatch', 'all'],(
        'test must be net, local, dispatch, or all')
    
    cp = CONFIG_PARSER
    testSections = []
    sections = [\
        'rpc_encoded' , 'rpc_encoded_broke',
        'rpc_literal', 'rpc_literal_broke', 'rpc_literal_broke_interop',
        'doc_literal', 'doc_literal_broke', 'doc_literal_broke_interop',
    ]
    boo = cp.getboolean
    for s,d,l,b in map(\
        lambda sec: \
            (sec, (None,boo(sec,DOCUMENT)), (None,boo(sec,LITERAL)), (None,boo(sec,BROKE))), sections):
        if document in d and literal in l and broke in b:
            testSections.append(s)
        
    suite = unittest.TestSuite()
    for section in testSections:
        moduleList = cp.get(section, TESTS).split()
        for module in  map(__import__, moduleList):
            def _warn_empty():
                warnings.warn('"%s" has no test "%s"' %(module, test))
                return unittest.TestSuite()
                
            s = getattr(module, test, _warn_empty)()
            suite.addTest(s)
    return suite

   
if __name__ == "__main__": 
    gridLog(prog="runTests.py", zsi="v%d.%d.%d" % version.Version, event="zsi.test.wsdl2py.runTests.ping")
    main()
    

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.