Skip to content

Commit

Permalink
Remove the static test discovery code
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.pyamf.org/branches/test-discovery-780@3366 2dde4cc4-cf3c-0410-b1a3-a9b8ff274da5
  • Loading branch information
njoyce committed Jun 7, 2010
1 parent c3f0bdb commit 27ab5d5
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 316 deletions.
11 changes: 2 additions & 9 deletions pyamf/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,15 @@

import os.path

try:
import unittest2 as unittest
import sys

sys.modules['unittest'] = unittest
except ImportError:
pass

import unittest

def get_suite():
"""
Discover the entire test suite.
"""
loader = unittest.TestLoader()

return loader.discover(os.path.dirname(__file__))
return loader.discover(os.path.dirname(__file__), top_level_dir='../pyamf')


def main():
Expand Down
33 changes: 17 additions & 16 deletions pyamf/tests/gateway/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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')
Loading

0 comments on commit 27ab5d5

Please sign in to comment.