diff --git a/pyamf/tests/__init__.py b/pyamf/tests/__init__.py index 67a47294..861fec61 100644 --- a/pyamf/tests/__init__.py +++ b/pyamf/tests/__init__.py @@ -9,14 +9,7 @@ import os.path -try: - import unittest2 as unittest - import sys - - sys.modules['unittest'] = unittest -except ImportError: - pass - +import unittest def get_suite(): """ @@ -24,7 +17,7 @@ def get_suite(): """ loader = unittest.TestLoader() - return loader.discover(os.path.dirname(__file__)) + return loader.discover(os.path.dirname(__file__), top_level_dir='../pyamf') def main(): diff --git a/pyamf/tests/gateway/test_google.py b/pyamf/tests/gateway/test_google.py index 1e31ad44..160420e9 100644 --- a/pyamf/tests/gateway/test_google.py +++ b/pyamf/tests/gateway/test_google.py @@ -13,18 +13,30 @@ from StringIO import StringIO -from google.appengine.ext import webapp +try: + from google.appengine.ext import webapp + from pyamf.remoting.gateway import google as google +except ImportError: + webapp = None import pyamf from pyamf import remoting -from pyamf.remoting.gateway import google as _google -class WebAppGatewayTestCase(unittest.TestCase): +class BaseTestCase(unittest.TestCase): + """ + """ + def setUp(self): - unittest.TestCase.setUp(self) + if not webapp: + raise unittest.SkipTest("'google' is not available") + - self.gw = _google.WebAppGateway() +class WebAppGatewayTestCase(BaseTestCase): + def setUp(self): + BaseTestCase.setUp(self) + + self.gw = google.WebAppGateway() self.environ = { 'wsgi.input': StringIO(), @@ -117,14 +129,3 @@ def echo(d): self.assertEqual(message.body, now) self.assertTrue(self.executed) - - -def suite(): - suite = unittest.TestSuite() - - suite.addTest(unittest.makeSuite(WebAppGatewayTestCase)) - - return suite - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/pyamf/tests/gateway/test_twisted.py b/pyamf/tests/gateway/test_twisted.py index d06f10d3..a47c36ba 100644 --- a/pyamf/tests/gateway/test_twisted.py +++ b/pyamf/tests/gateway/test_twisted.py @@ -7,16 +7,22 @@ @since: 0.1.0 """ -from twisted.internet import reactor, defer -from twisted.python import failure -from twisted.web import http, server, client, error, resource -from twisted.trial import unittest +try: + from twisted.internet import reactor, defer + from twisted.python import failure + from twisted.web import http, server, client, error, resource + from twisted.trial import unittest + + from pyamf.remoting.gateway import twisted +except ImportError: + twisted = None + + import unittest import pyamf from pyamf import remoting from pyamf.remoting import gateway from pyamf.flex import messaging -from pyamf.remoting.gateway import twisted as _twisted class TestService(object): @@ -27,9 +33,23 @@ def echo(self, x): return x -class TwistedServerTestCase(unittest.TestCase): +class BaseTestCase(unittest.TestCase): + """ + """ + + def setUp(self): + if not twisted: + raise unittest.SkipTest("'twisted' is not available") + + +class TwistedServerTestCase(BaseTestCase): + """ + """ + def setUp(self): - self.gw = _twisted.TwistedGateway(expose_request=False) + BaseTestCase.setUp(self) + + self.gw = twisted.TwistedGateway(expose_request=False) root = resource.Resource() root.putChild('', self.gw) @@ -169,7 +189,7 @@ def pp(sr): self.assertIdentical(sr, self.service_request) d.callback(None) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=pp) + gw = twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=pp) self.service_request = gateway.ServiceRequest(None, gw.services['echo'], None) gw.preprocessRequest(self.service_request) @@ -186,7 +206,7 @@ def pp(hr, sr): pp = gateway.expose_request(pp) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=pp) + gw = twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=pp) self.service_request = gateway.ServiceRequest(None, gw.services['echo'], None) gw.preprocessRequest(self.service_request, http_request='hello') @@ -203,7 +223,7 @@ def pp(hr, sr): pp = gateway.expose_request(pp) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=pp) + gw = twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=pp) self.service_request = gateway.ServiceRequest(None, gw.services['echo'], None) gw.preprocessRequest(self.service_request) @@ -222,7 +242,7 @@ def auth(u, p): else: d.callback(None) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) + gw = twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) self.service_request = gateway.ServiceRequest(None, gw.services['echo'], None) gw.authenticateRequest(self.service_request, 'u', 'p') @@ -244,7 +264,7 @@ def auth(request, u, p): auth = gateway.expose_request(auth) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) + gw = twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) self.service_request = gateway.ServiceRequest(None, gw.services['echo'], None) gw.authenticateRequest(self.service_request, 'u', 'p', http_request='foo') @@ -252,7 +272,7 @@ def auth(request, u, p): return d def test_encoding_error(self): - encode = _twisted.remoting.encode + encode = twisted.remoting.encode def force_error(amf_request, context=None): raise pyamf.EncodeError @@ -269,9 +289,9 @@ def echo(request, data): d = client.getPage("http://127.0.0.1:%d/" % (self.port,), method="POST", postdata=remoting.encode(env).getvalue()) - _twisted.remoting.encode = force_error + twisted.remoting.encode = force_error def switch(x): - _twisted.remoting.encode = encode + twisted.remoting.encode = encode d = self.assertFailure(d, error.Error) @@ -381,10 +401,10 @@ def finish(self): self.finished = True -class TwistedGatewayTestCase(unittest.TestCase): +class TwistedGatewayTestCase(BaseTestCase): def test_finalise_request(self): request = DummyHTTPRequest() - gw = _twisted.TwistedGateway() + gw = twisted.TwistedGateway() gw._finaliseRequest(request, 200, 'xyz', 'text/plain') @@ -402,16 +422,16 @@ def test_get_processor(self): a3 = pyamf.ASObject({'target': 'null'}) a0 = pyamf.ASObject({'target': 'foo.bar'}) - gw = _twisted.TwistedGateway() + gw = twisted.TwistedGateway() - self.assertTrue(isinstance(gw.getProcessor(a3), _twisted.AMF3RequestProcessor)) - self.assertTrue(isinstance(gw.getProcessor(a0), _twisted.AMF0RequestProcessor)) + self.assertTrue(isinstance(gw.getProcessor(a3), twisted.AMF3RequestProcessor)) + self.assertTrue(isinstance(gw.getProcessor(a0), twisted.AMF0RequestProcessor)) -class AMF0RequestProcessorTestCase(unittest.TestCase): +class AMF0RequestProcessorTestCase(BaseTestCase): def test_unknown_service_request(self): - gw = _twisted.TwistedGateway({'echo': lambda x: x}) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('sdf') @@ -427,8 +447,8 @@ def test_error_auth(self): def auth(u, p): raise IndexError - gw = _twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) @@ -445,8 +465,8 @@ def test_auth_fail(self): def auth(u, p): return False - gw = _twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) @@ -465,8 +485,8 @@ def test_deferred_auth(self): def auth(u, p): return reactor.callLater(0, lambda: True) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, authenticator=auth) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) @@ -482,8 +502,8 @@ def test_error_preprocessor(self): def preprocessor(service_request): raise IndexError - gw = _twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=preprocessor) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=preprocessor) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) @@ -502,8 +522,8 @@ def test_deferred_preprocessor(self): def preprocessor(u, p): return reactor.callLater(0, lambda: True) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=preprocessor) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=preprocessor) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) @@ -521,8 +541,8 @@ def test_preprocessor(self): def preprocessor(service_request): d.callback(None) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=preprocessor) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=preprocessor) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) @@ -537,8 +557,8 @@ def preprocessor(http_request, service_request): return reactor.callLater(0, lambda: True) preprocessor = gateway.expose_request(preprocessor) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=preprocessor) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=preprocessor) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) @@ -554,8 +574,8 @@ def test_error_body(self): def echo(x): raise KeyError - gw = _twisted.TwistedGateway({'echo': echo}) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': echo}) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) @@ -582,8 +602,8 @@ def cb(result): d2.addCallback(cb) return d2 - gw = _twisted.TwistedGateway({'echo': echo}, expose_request=False) - proc = _twisted.AMF0RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': echo}, expose_request=False) + proc = twisted.AMF0RequestProcessor(gw) request = remoting.Request('echo', envelope=remoting.Envelope()) request.body = ['a'] @@ -604,10 +624,10 @@ def cb(result): return d -class AMF3RequestProcessorTestCase(unittest.TestCase): +class AMF3RequestProcessorTestCase(BaseTestCase): def test_unknown_service_request(self): - gw = _twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False) - proc = _twisted.AMF3RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.RemotingMessage(body=['spam.eggs'], operation='ss')]) @@ -623,9 +643,9 @@ def test_error_preprocessor(self): def preprocessor(service_request, *args): raise IndexError - gw = _twisted.TwistedGateway({'echo': lambda x: x}, + gw = twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False, preprocessor=preprocessor) - proc = _twisted.AMF3RequestProcessor(gw) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.RemotingMessage(body=['spam.eggs'], operation='echo')]) @@ -647,8 +667,8 @@ def preprocessor(u, *args): return d2 - gw = _twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False, preprocessor=preprocessor) - proc = _twisted.AMF3RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False, preprocessor=preprocessor) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.RemotingMessage(body=['spam.eggs'], operation='echo')]) @@ -666,8 +686,8 @@ def test_preprocessor(self): def preprocessor(service_request, *args): d.callback(None) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False, preprocessor=preprocessor) - proc = _twisted.AMF3RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False, preprocessor=preprocessor) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.RemotingMessage(body=['spam.eggs'], operation='echo')]) @@ -682,8 +702,8 @@ def preprocessor(http_request, service_request): return reactor.callLater(0, lambda: True) preprocessor = gateway.expose_request(preprocessor) - gw = _twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False, preprocessor=preprocessor) - proc = _twisted.AMF3RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': lambda x: x}, expose_request=False, preprocessor=preprocessor) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.RemotingMessage(body=['spam.eggs'], operation='echo')]) @@ -703,8 +723,8 @@ def test_error_body(self): def echo(x): raise KeyError - gw = _twisted.TwistedGateway({'echo': echo}, expose_request=False) - proc = _twisted.AMF3RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': echo}, expose_request=False) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.RemotingMessage(body=['spam.eggs'], operation='echo')]) @@ -731,8 +751,8 @@ def cb(result): d2.addCallback(cb) return d2 - gw = _twisted.TwistedGateway({'echo': echo}, expose_request=False) - proc = _twisted.AMF3RequestProcessor(gw) + gw = twisted.TwistedGateway({'echo': echo}, expose_request=False) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.RemotingMessage(body=['spam.eggs'], operation='echo')]) @@ -754,8 +774,8 @@ def cb(result): def test_destination(self): d = defer.Deferred() - gw = _twisted.TwistedGateway({'spam.eggs': lambda x: x}, expose_request=False) - proc = _twisted.AMF3RequestProcessor(gw) + gw = twisted.TwistedGateway({'spam.eggs': lambda x: x}, expose_request=False) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.RemotingMessage(body=[None], destination='spam', operation='eggs')]) @@ -774,8 +794,8 @@ def cb(result): def test_async(self): d = defer.Deferred() - gw = _twisted.TwistedGateway({'spam.eggs': lambda x: x}, expose_request=False) - proc = _twisted.AMF3RequestProcessor(gw) + gw = twisted.TwistedGateway({'spam.eggs': lambda x: x}, expose_request=False) + proc = twisted.AMF3RequestProcessor(gw) request = remoting.Request('null', body=[messaging.AsyncMessage(body=[None], destination='spam', operation='eggs')]) @@ -792,19 +812,3 @@ def cb(result): proc(request).addCallback(cb).addErrback(lambda failure: d.errback()) return d - - -def suite(): - import unittest - - suite = unittest.TestSuite() - - suite.addTest(unittest.makeSuite(TwistedServerTestCase)) - suite.addTest(unittest.makeSuite(TwistedGatewayTestCase)) - suite.addTest(unittest.makeSuite(AMF0RequestProcessorTestCase)) - suite.addTest(unittest.makeSuite(AMF3RequestProcessorTestCase)) - - return suite - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/pyamf/tests/test_adapters_util.py b/pyamf/tests/test_adapters_util.py index 8ec8146e..370beffc 100644 --- a/pyamf/tests/test_adapters_util.py +++ b/pyamf/tests/test_adapters_util.py @@ -70,18 +70,3 @@ def test_to_tuple(self): obj = object() self.assertRaises(TypeError, util.to_tuple, obj, self.encoder) - - -def suite(): - suite = unittest.TestSuite() - - suite.addTest(unittest.makeSuite(HelperTestCase)) - - return suite - - -def main(): - unittest.main(defaultTest='suite') - -if __name__ == '__main__': - main() diff --git a/pyamf/tests/test_alias.py b/pyamf/tests/test_alias.py index de7110f2..07767782 100644 --- a/pyamf/tests/test_alias.py +++ b/pyamf/tests/test_alias.py @@ -1067,28 +1067,3 @@ def test_anonymous(self): self.assertTrue('foo' in pyamf.CLASS_CACHE) self.assertFalse(Spam in pyamf.CLASS_CACHE) self.assertTrue(ret is alias) - - -def suite(): - suite = unittest.TestSuite() - - test_cases = [ - ClassAliasTestCase, - GetDecodableAttributesTestCase, - GetEncodableAttributesTestCase, - ApplyAttributesTestCase, - SimpleCompliationTestCase, - CompilationIntegrationTestCase, - CompilationInheritanceTestCase, - RegisterClassTestCase, - UnregisterClassTestCase - ] - - for tc in test_cases: - suite.addTest(unittest.makeSuite(tc)) - - return suite - - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/pyamf/tests/test_amf0.py b/pyamf/tests/test_amf0.py index ab4dfd29..fb4c9ea0 100644 --- a/pyamf/tests/test_amf0.py +++ b/pyamf/tests/test_amf0.py @@ -1136,26 +1136,3 @@ class XYZ(Exception): self.assertEqual(self.buffer.getvalue(), '\x10\x00\x07foo.bar\x00' '\x07message\x02\x00\x05blarg\x00\x04name\x02\x00\x03XYZ\x00\x00\t') - - -def suite(): - suite = unittest.TestSuite() - - test_cases = [ - TypesTestCase, - ContextTestCase, - EncoderTestCase, - DecoderTestCase, - RecordSetTestCase, - HelperTestCase, - ClassInheritanceTestCase, - ExceptionEncodingTestCase - ] - - for tc in test_cases: - suite.addTest(unittest.makeSuite(tc)) - - return suite - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/pyamf/tests/test_amf3.py b/pyamf/tests/test_amf3.py index 3830fe2b..5e1d7b3d 100644 --- a/pyamf/tests/test_amf3.py +++ b/pyamf/tests/test_amf3.py @@ -1771,32 +1771,3 @@ def test_read_context(self): self.assertEqual(obj, b.readObject()) self.assertRaises(pyamf.ReferenceError, b.readObject) - - -def suite(): - suite = unittest.TestSuite() - - test_cases = [ - TypesTestCase, - ClassDefinitionTestCase, - ContextTestCase, - EncoderTestCase, - DecoderTestCase, - ObjectEncodingTestCase, - ObjectDecodingTestCase, - DataOutputTestCase, - DataInputTestCase, - ClassInheritanceTestCase, - HelperTestCase, - ComplexEncodingTestCase, - ExceptionEncodingTestCase, - ByteArrayTestCase - ] - - for tc in test_cases: - suite.addTest(unittest.makeSuite(tc)) - - return suite - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/pyamf/tests/test_basic.py b/pyamf/tests/test_basic.py index d8a2a7dd..417b6999 100644 --- a/pyamf/tests/test_basic.py +++ b/pyamf/tests/test_basic.py @@ -715,28 +715,3 @@ class Bar: self.assertTrue(isinstance(alias, pyamf.ClassAlias)) self.assertEqual(alias.klass, c) self.assertEqual(alias.alias, 'spam.eggs.' + c.__name__) - - -def suite(): - suite = unittest.TestSuite() - - test_cases = [ - ASObjectTestCase, - HelperTestCase, - UnregisterClassTestCase, - ClassLoaderTestCase, - TypeMapTestCase, - ErrorClassMapTestCase, - RegisterAliasTypeTestCase, - BaseContextTestCase, - TypedObjectTestCase, - PackageTestCase - ] - - for tc in test_cases: - suite.addTest(unittest.makeSuite(tc)) - - return suite - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/pyamf/tests/test_flex.py b/pyamf/tests/test_flex.py index a2199ec4..098a2490 100644 --- a/pyamf/tests/test_flex.py +++ b/pyamf/tests/test_flex.py @@ -224,16 +224,3 @@ def test_repr(self): x = flex.ObjectProxy(u'ƒøø') self.assertEqual(repr(x), "") - - -def suite(): - suite = unittest.TestSuite() - - suite.addTest(unittest.makeSuite(ArrayCollectionTestCase)) - suite.addTest(unittest.makeSuite(ArrayCollectionAPITestCase)) - suite.addTest(unittest.makeSuite(ObjectProxyTestCase)) - - return suite - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/pyamf/tests/test_flex_messaging.py b/pyamf/tests/test_flex_messaging.py index d83db744..78fc3337 100644 --- a/pyamf/tests/test_flex_messaging.py +++ b/pyamf/tests/test_flex_messaging.py @@ -195,21 +195,3 @@ def test_getmessage(self): self.assertTrue(isinstance(m, messaging.AcknowledgeMessageExt)) self.assertEqual(m.__dict__, k) - - -def suite(): - suite = unittest.TestSuite() - - test_cases = [ - AbstractMessageTestCase, - EncodingTestCase, - SmallMessageTestCase - ] - - for tc in test_cases: - suite.addTest(unittest.makeSuite(tc)) - - return suite - -if __name__ == '__main__': - unittest.main(defaultTest='suite') diff --git a/pyamf/tests/test_gateway.py b/pyamf/tests/test_gateway.py index ce931865..4469c9d5 100644 --- a/pyamf/tests/test_gateway.py +++ b/pyamf/tests/test_gateway.py @@ -777,70 +777,3 @@ def preproc(sr, *args): self.assertTrue(isinstance(response, remoting.Response)) self.assertEqual(response.status, remoting.STATUS_ERROR) - - -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 - -if __name__ == '__main__': - unittest.main(defaultTest='suite')