source: TI02-CSML/trunk/services/3rdParty/GeoTypes-0.6.0/tests/PsycopgInit_Test.py @ 2194

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/services/3rdParty/GeoTypes-0.6.0/tests/PsycopgInit_Test.py@2194
Revision 2194, 1.8 KB checked in by lawrence, 13 years ago (diff)

Adding various specs and 3rd party code of interest for the CSML
services development.

Line 
1
2################################################################################
3# Copyright (c) QinetiQ Plc 2003
4#
5# Licensed under the LGPL. For full license details see the LICENSE file.
6################################################################################
7
8import unittest
9import psycopg
10import TestConfig
11
12
13from _Point import Point
14
15import os
16if not os.environ.get('USECOVERAGE') == '1':
17    import _PsycopgInit
18
19class PsycopgInitTest(unittest.TestCase):   
20
21    def setUp(self):
22        pass
23   
24    def testPsycopgInit(self):
25        _PsycopgInit.initialisePsycopgTypes(psycopg_module=psycopg)
26        _PsycopgInit.initialisePsycopgTypes(psycopg_module=psycopg,connect_string="dbname=mq_test user=postgres")
27        _PsycopgInit.initialisePsycopgTypes(psycopg_module=psycopg,connect_string="dbname=mq_test user=postgres",
28                                            register_opengis_types=1)
29
30        class MyPoint(Point):
31            pass
32       
33        _PsycopgInit.initialisePsycopgTypes(psycopg_module=psycopg,subclass_map={'point':MyPoint})
34
35
36def testSuite():
37    return unittest.makeSuite(PsycopgInitTest,'test')
38
39if __name__ == "__main__":
40    import os
41    if os.environ.get('USECOVERAGE') == '1':
42        try:
43            import coverage
44            coverage.erase()
45            coverage.start()
46            COVERAGE = 1
47            import _PsycopgInit
48
49        except:
50            print "Error setting up coverage checking"
51            COVERAGE = 0
52    else:
53        COVERAGE = 0
54
55    if os.environ.get('USEPYCHECK') == '1':
56        try:
57            import pychecker.checker
58        except:
59            print "Pychecker not installed on this machine"
60
61    unittest.TextTestRunner().run(testSuite())
62
63    if COVERAGE:
64        coverage.stop()
65        x = coverage.analysis(_PsycopgInit)
66        print "\n"
67        coverage.report(_PsycopgInit)
Note: See TracBrowser for help on using the repository browser.