__init__.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. import os, sys
  24. import unittest
  25. if os.path.exists("extended_setup.py"):
  26. print "-" * 75
  27. print "You should not run the test suite from the pysqlite build directory."
  28. print "This does not work well because the extension module cannot be found."
  29. print "Just run the test suite from somewhere else, please!"
  30. print "-" * 75
  31. sys.exit(1)
  32. from pysqlite2.test import dbapi, types, userfunctions, factory, transactions,\
  33. hooks, regression, dump
  34. from pysqlcipher import dbapi2 as sqlite
  35. def suite():
  36. tests = [dbapi.suite(), types.suite(), userfunctions.suite(),
  37. factory.suite(), transactions.suite(), hooks.suite(), regression.suite(), dump.suite()]
  38. if sys.version_info >= (2, 5, 0):
  39. from pysqlite2.test.py25 import py25tests
  40. tests.append(py25tests.suite())
  41. return unittest.TestSuite(tuple(tests))
  42. def test():
  43. runner = unittest.TextTestRunner()
  44. runner.run(suite())