tests/run.py
author Todd Larsen <tlarsen@google.com>
Fri, 21 Nov 2008 22:38:38 +0000
changeset 537 f2bd9c465a6d
parent 421 11aa742bf1dc
child 780 042aafcd7dce
permissions -rw-r--r--
Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic after the recent refactoring. Remove 'Link scope' drop-down from Edit Site Settings form. Patch by: Todd Larsen
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
419
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/env python
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     2
import sys
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     3
import os
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     4
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     5
HERE = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     6
                                     '..'))
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     7
appengine_location = os.path.join(HERE, 'thirdparty', 'google_appengine')
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     8
extra_paths = [HERE,
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     9
               os.path.join(appengine_location, 'lib', 'django'),
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    10
               os.path.join(appengine_location, 'lib', 'webob'),
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    11
               os.path.join(appengine_location, 'lib', 'yaml', 'lib'),
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    12
               appengine_location,
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    13
               os.path.join(HERE, 'app'),
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    14
              ]
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    15
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    16
import nose
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    17
from nose import config
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    18
from nose.plugins import manager
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    19
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    20
def main():
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    21
  sys.path = extra_paths + sys.path
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    22
  os.environ['SERVER_SOFTWARE'] = 'Development via nose'
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    23
  os.environ['SERVER_NAME'] = 'Foo'
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    24
  os.environ['SERVER_PORT'] = '8080'
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    25
  os.environ['APPLICATION_ID'] = 'test-app-run'
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    26
  import main as app_main
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    27
  from google.appengine.api import apiproxy_stub_map
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    28
  from google.appengine.api import datastore_file_stub
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    29
  from google.appengine.api import mail_stub
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    30
  from google.appengine.api import user_service_stub
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    31
  from google.appengine.api import urlfetch_stub
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    32
  apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    33
  apiproxy_stub_map.apiproxy.RegisterStub('urlfetch',
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    34
                                          urlfetch_stub.URLFetchServiceStub())
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    35
  apiproxy_stub_map.apiproxy.RegisterStub('user',
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    36
                                          user_service_stub.UserServiceStub())
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    37
  apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3',
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    38
    datastore_file_stub.DatastoreFileStub('your_app_id', '/dev/null',
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    39
                                          '/dev/null'))
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    40
  apiproxy_stub_map.apiproxy.RegisterStub('mail', mail_stub.MailServiceStub())
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    41
  nose.main(config=config.Config(files=config.all_config_files()))
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    42
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    43
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    44
if __name__ == '__main__':
e9280ea935e4 Start a test system for the webapp itself.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    45
  main()