home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 June / maximum-cd-2011-06.iso / DiscContents / xbmc-10.1.exe / addons / script.module.pysqlite / lib / pysqlite2 / test / __init__.py next >
Encoding:
Python Source  |  2009-10-19  |  1.9 KB  |  51 lines

  1. #-*- coding: ISO-8859-1 -*-
  2. # pysqlite2/test/__init__.py: the package containing the test suite
  3. #
  4. # Copyright (C) 2004-2007 Gerhard HΣring <gh@ghaering.de>
  5. #
  6. # This file is part of pysqlite.
  7. #
  8. # This software is provided 'as-is', without any express or implied
  9. # warranty.  In no event will the authors be held liable for any damages
  10. # arising from the use of this software.
  11. #
  12. # Permission is granted to anyone to use this software for any purpose,
  13. # including commercial applications, and to alter it and redistribute it
  14. # freely, subject to the following restrictions:
  15. #
  16. # 1. The origin of this software must not be misrepresented; you must not
  17. #    claim that you wrote the original software. If you use this software
  18. #    in a product, an acknowledgment in the product documentation would be
  19. #    appreciated but is not required.
  20. # 2. Altered source versions must be plainly marked as such, and must not be
  21. #    misrepresented as being the original software.
  22. # 3. This notice may not be removed or altered from any source distribution.
  23.  
  24. import os, sys
  25. import unittest
  26.  
  27. if os.path.exists("extended_setup.py"):
  28.     print "-" * 75
  29.     print "You should not run the test suite from the pysqlite build directory."
  30.     print "This does not work well because the extension module cannot be found."
  31.     print "Just run the test suite from somewhere else, please!"
  32.     print "-" * 75
  33.     sys.exit(1)
  34.  
  35. from pysqlite2.test import dbapi, types, userfunctions, factory, transactions,\
  36.     hooks, regression, dump
  37. from pysqlite2 import dbapi2 as sqlite
  38.  
  39. def suite():
  40.     tests = [dbapi.suite(), types.suite(), userfunctions.suite(),
  41.       factory.suite(), transactions.suite(), hooks.suite(), regression.suite(), dump.suite()]
  42.     if sys.version_info >= (2, 5, 0):
  43.         from pysqlite2.test import py25tests
  44.         tests.append(py25tests.suite())
  45.  
  46.     return unittest.TestSuite(tuple(tests))
  47.  
  48. def test():
  49.     runner = unittest.TextTestRunner()
  50.     runner.run(suite())
  51.