コード例 #1
0
def suite():
    suite = unittest.TestSuite()

    # basics first
    suite.addTest(unittest.makeSuite(FaultTestCase))
    suite.addTest(unittest.makeSuite(ServiceWrapperTestCase))
    suite.addTest(unittest.makeSuite(ServiceRequestTestCase))
    suite.addTest(unittest.makeSuite(ServiceCollectionTestCase))
    suite.addTest(unittest.makeSuite(BaseGatewayTestCase))
    suite.addTest(unittest.makeSuite(QueryBrowserTestCase))
    suite.addTest(unittest.makeSuite(AuthenticatorTestCase))
    suite.addTest(unittest.makeSuite(ExposeRequestTestCase))
    suite.addTest(unittest.makeSuite(PreProcessingTestCase))

    try:
        import wsgiref
    except ImportError:
        wsgiref = None

    if wsgiref:
        from pyamf.tests.gateway import test_wsgi

        suite.addTest(test_wsgi.suite())

    try:
        from twisted import web
    except ImportError:
        web = None

    if web:
        from pyamf.tests.gateway import test_twisted

        suite.addTest(test_twisted.suite())

    try:
        import django
    except ImportError:
        django = None

    if django:
        import os, sys

        if 'DJANGO_SETTINGS_MODULE' not in os.environ:
            import imp, sys

            mod = imp.new_module('pyamf.test_django')
            os.environ['DJANGO_SETTINGS_MODULE'] = 'pyamf.test_django'
            sys.modules['pyamf.test_django'] = mod

            setattr(mod, 'DATABASE_ENGINE', 'sqlite3')
            setattr(mod, 'DATABASE_NAME', ':memory:')

        from pyamf.tests.gateway import test_django

        #suite.addTest(test_django.suite())

    return suite
コード例 #2
0
def suite():
    suite = unittest.TestSuite()

    # basics first
    suite.addTest(unittest.makeSuite(FaultTestCase))
    suite.addTest(unittest.makeSuite(ServiceWrapperTestCase))
    suite.addTest(unittest.makeSuite(ServiceRequestTestCase))
    suite.addTest(unittest.makeSuite(ServiceCollectionTestCase))
    suite.addTest(unittest.makeSuite(BaseGatewayTestCase))
    suite.addTest(unittest.makeSuite(QueryBrowserTestCase))
    suite.addTest(unittest.makeSuite(AuthenticatorTestCase))
    suite.addTest(unittest.makeSuite(ExposeRequestTestCase))
    suite.addTest(unittest.makeSuite(PreProcessingTestCase))

    try:
        import wsgiref
    except ImportError:
        wsgiref = None

    if wsgiref:
        from pyamf.tests.gateway import test_wsgi

        suite.addTest(test_wsgi.suite())

    try:
        from twisted import web
    except ImportError:
        web = None

    if web:
        from pyamf.tests.gateway import test_twisted

        suite.addTest(test_twisted.suite())

    try:
        import django
    except ImportError:
        django = None

    if django:
        from pyamf.tests.gateway import test_django

        suite.addTest(test_django.suite())

    try:
        from google.appengine.ext import webapp
    except ImportError:
        try:
            import dev_appserver

            sys.path = dev_appserver.EXTRA_PATHS + sys.path

            from google.appengine.ext import webapp
        except ImportError:
            webapp = None

    if webapp:
        from pyamf.tests.gateway import test_google

        suite.addTest(test_google.suite())

    return suite