source: cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/__init__.py @ 7345

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cowsserver/branches/migrate-py26-pylons10/lib/cowsserver/tests/__init__.py@7345
Revision 7345, 1.1 KB checked in by spascoe, 9 years ago (diff)

Fixed a bunch of errors exposed by the tests (what few there are).

Several tests are still failing because they are out of date with the codebase.

Line 
1"""Pylons application test package
2
3When the test runner finds and executes tests within this directory,
4this file will be loaded to setup the test environment.
5
6It registers the root directory of the project in sys.path and
7pkg_resources, in case the project hasn't been installed with
8setuptools. It also initializes the application via websetup (paster
9setup-app) with the project's test.ini configuration file.
10"""
11import os
12import sys
13from unittest import TestCase
14
15from paste.deploy import loadapp
16from paste.script.appinstall import SetupCommand
17from pylons import url
18from routes.util import URLGenerator
19from webtest import TestApp
20
21import pylons.test
22
23__all__ = ['environ', 'url', 'TestController']
24
25# Invoke websetup with the current config file
26SetupCommand('setup-app').run([pylons.test.pylonsapp.config['__file__']])
27
28environ = {}
29
30class TestController(TestCase):
31
32    def __init__(self, *args, **kwargs):
33        wsgiapp = pylons.test.pylonsapp
34        config = wsgiapp.config
35        self.app = TestApp(wsgiapp)
36        url._push_object(URLGenerator(config['routes.map'], environ))
37        TestCase.__init__(self, *args, **kwargs)
38
Note: See TracBrowser for help on using the repository browser.