2007-11-11 13:40:12 +03:00
|
|
|
#!/usr/bin/env python
|
2010-02-13 01:34:53 +03:00
|
|
|
|
2011-01-07 04:44:19 +03:00
|
|
|
# psycopg2 test suite
|
|
|
|
#
|
|
|
|
# Copyright (C) 2007-2011 Federico Di Gregorio <fog@debian.org>
|
|
|
|
#
|
|
|
|
# psycopg2 is free software: you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU Lesser General Public License as published
|
|
|
|
# by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# In addition, as a special exception, the copyright holders give
|
|
|
|
# permission to link this program with the OpenSSL library (or with
|
|
|
|
# modified versions of OpenSSL that use the same license as OpenSSL),
|
|
|
|
# and distribute linked combinations including the two.
|
|
|
|
#
|
|
|
|
# You must obey the GNU Lesser General Public License in all respects for
|
|
|
|
# all of the code used other than OpenSSL.
|
|
|
|
#
|
|
|
|
# psycopg2 is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
# License for more details.
|
|
|
|
|
2010-12-01 23:56:25 +03:00
|
|
|
import sys
|
2010-12-21 07:58:38 +03:00
|
|
|
from testconfig import dsn
|
2010-11-19 06:55:37 +03:00
|
|
|
from testutils import unittest
|
2007-09-08 12:54:30 +04:00
|
|
|
|
2011-11-18 04:10:53 +04:00
|
|
|
import test_async
|
2011-10-19 05:20:43 +04:00
|
|
|
import test_bugX000
|
2011-11-18 04:10:53 +04:00
|
|
|
import test_bug_gc
|
|
|
|
import test_cancel
|
|
|
|
import test_connection
|
|
|
|
import test_copy
|
|
|
|
import test_cursor
|
2008-01-16 04:43:50 +03:00
|
|
|
import test_dates
|
2011-11-18 04:10:53 +04:00
|
|
|
import test_extras_dictcursor
|
|
|
|
import test_green
|
|
|
|
import test_lobject
|
|
|
|
import test_module
|
|
|
|
import test_notify
|
2007-11-11 13:40:12 +03:00
|
|
|
import test_psycopg2_dbapi20
|
|
|
|
import test_quote
|
|
|
|
import test_transaction
|
2011-10-19 05:20:43 +04:00
|
|
|
import test_types_basic
|
|
|
|
import test_types_extras
|
2007-09-08 12:54:30 +04:00
|
|
|
|
2012-12-03 06:50:24 +04:00
|
|
|
if sys.version_info[:2] >= (2, 5):
|
|
|
|
import test_with
|
|
|
|
else:
|
|
|
|
test_with = None
|
|
|
|
|
2007-11-11 13:40:12 +03:00
|
|
|
def test_suite():
|
2011-03-30 18:52:49 +04:00
|
|
|
# If connection to test db fails, bail out early.
|
|
|
|
import psycopg2
|
|
|
|
try:
|
|
|
|
cnn = psycopg2.connect(dsn)
|
|
|
|
except Exception, e:
|
|
|
|
print "Failed connection to test db:", e.__class__.__name__, e
|
|
|
|
print "Please set env vars 'PSYCOPG2_TESTDB*' to valid values."
|
|
|
|
sys.exit(1)
|
|
|
|
else:
|
|
|
|
cnn.close()
|
|
|
|
|
2007-11-11 13:40:12 +03:00
|
|
|
suite = unittest.TestSuite()
|
2011-11-18 04:10:53 +04:00
|
|
|
suite.addTest(test_async.test_suite())
|
2011-10-19 05:20:43 +04:00
|
|
|
suite.addTest(test_bugX000.test_suite())
|
2011-11-18 04:10:53 +04:00
|
|
|
suite.addTest(test_bug_gc.test_suite())
|
|
|
|
suite.addTest(test_cancel.test_suite())
|
|
|
|
suite.addTest(test_connection.test_suite())
|
|
|
|
suite.addTest(test_copy.test_suite())
|
|
|
|
suite.addTest(test_cursor.test_suite())
|
2008-01-16 04:43:50 +03:00
|
|
|
suite.addTest(test_dates.test_suite())
|
2011-11-18 04:10:53 +04:00
|
|
|
suite.addTest(test_extras_dictcursor.test_suite())
|
|
|
|
suite.addTest(test_green.test_suite())
|
|
|
|
suite.addTest(test_lobject.test_suite())
|
|
|
|
suite.addTest(test_module.test_suite())
|
|
|
|
suite.addTest(test_notify.test_suite())
|
2007-11-11 13:40:12 +03:00
|
|
|
suite.addTest(test_psycopg2_dbapi20.test_suite())
|
|
|
|
suite.addTest(test_quote.test_suite())
|
|
|
|
suite.addTest(test_transaction.test_suite())
|
2011-10-19 05:20:43 +04:00
|
|
|
suite.addTest(test_types_basic.test_suite())
|
|
|
|
suite.addTest(test_types_extras.test_suite())
|
2012-12-03 06:50:24 +04:00
|
|
|
if test_with:
|
|
|
|
suite.addTest(test_with.test_suite())
|
2007-11-11 13:40:12 +03:00
|
|
|
return suite
|
2007-09-08 12:54:30 +04:00
|
|
|
|
2007-11-11 13:40:12 +03:00
|
|
|
if __name__ == '__main__':
|
2011-01-03 19:29:58 +03:00
|
|
|
unittest.main(defaultTest='test_suite')
|