Anthony Baxter | 72289a6 | 2006-04-04 06:29:05 +0000 | [diff] [blame] | 1 | #-*- coding: ISO-8859-1 -*- |
| 2 | # pysqlite2/test/regression.py: pysqlite regression tests |
| 3 | # |
| 4 | # Copyright (C) 2006 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 unittest |
| 25 | import pysqlite2.dbapi2 as sqlite |
| 26 | |
| 27 | class RegressionTests(unittest.TestCase): |
| 28 | def setUp(self): |
| 29 | self.con = sqlite.connect(":memory:") |
| 30 | |
| 31 | def tearDown(self): |
| 32 | self.con.close() |
| 33 | |
| 34 | def CheckPragmaUserVersion(self): |
| 35 | # This used to crash pysqlite because this pragma command returns NULL for the column name |
| 36 | cur = self.con.cursor() |
| 37 | cur.execute("pragma user_version") |
| 38 | |
| 39 | def suite(): |
| 40 | regression_suite = unittest.makeSuite(RegressionTests, "Check") |
| 41 | return unittest.TestSuite((regression_suite,)) |
| 42 | |
| 43 | def test(): |
| 44 | runner = unittest.TextTestRunner() |
| 45 | runner.run(suite()) |
| 46 | |
| 47 | if __name__ == "__main__": |
| 48 | test() |