~psycopg/psycopg/2.0.x

« back to all changes in this revision

Viewing changes to runtests.py

  • Committer: James Henstridge
  • Date: 2008-02-27 02:29:55 UTC
  • Revision ID: jamesh-31e386fa93dc99d3a323ef645a2eb265186ad4e9
        * runtests.py: add a harness to run all the psycopg tests against
        the version built by distutils.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""A harness to run the psycopg test suite.
 
2
 
 
3
If the distutils build directory exists, it will be inserted into the
 
4
path so that the tests run against that version of psycopg.
 
5
"""
 
6
 
 
7
from distutils.util import get_platform
 
8
import os
 
9
import sys
 
10
import unittest
 
11
 
 
12
# Insert the distutils build directory into the path, if it exists.
 
13
platlib = os.path.join(os.path.dirname(__file__), 'build',
 
14
                       'lib.%s-%s' % (get_platform(), sys.version[0:3]))
 
15
if os.path.exists(platlib):
 
16
    sys.path.insert(0, platlib)
 
17
 
 
18
import psycopg2
 
19
import tests
 
20
 
 
21
def test_suite():
 
22
    return tests.test_suite()
 
23
 
 
24
if __name__ == '__main__':
 
25
    unittest.main(defaultTest='test_suite')
 
26