mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-45181: Simplify loading sqlite3 tests (GH-28304)
Use unittest discover instead of manually enumerating all test modules and classes. Also add support for filtering them by pattern.
This commit is contained in:
parent
9260e67398
commit
3e19409d64
10 changed files with 14 additions and 146 deletions
|
@ -160,8 +160,5 @@ class BackupTests(unittest.TestCase):
|
|||
self.verify_backup(bck)
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromTestCase(BackupTests)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
|
@ -1156,28 +1156,5 @@ class MultiprocessTests(unittest.TestCase):
|
|||
self.assertEqual(proc.returncode, 0)
|
||||
|
||||
|
||||
def suite():
|
||||
tests = [
|
||||
ClosedConTests,
|
||||
ClosedCurTests,
|
||||
ConnectionTests,
|
||||
ConstructorTests,
|
||||
CursorTests,
|
||||
ExtensionTests,
|
||||
ModuleTests,
|
||||
MultiprocessTests,
|
||||
OpenTests,
|
||||
SqliteOnConflictTests,
|
||||
ThreadTests,
|
||||
UninitialisedConnectionTests,
|
||||
]
|
||||
return unittest.TestSuite(
|
||||
[unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
|
||||
)
|
||||
|
||||
def test():
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite())
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
unittest.main()
|
|
@ -70,17 +70,6 @@ class DumpTests(unittest.TestCase):
|
|||
got = list(self.cx.iterdump())
|
||||
self.assertEqual(expected, got)
|
||||
|
||||
def suite():
|
||||
tests = [
|
||||
DumpTests,
|
||||
]
|
||||
return unittest.TestSuite(
|
||||
[unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
|
||||
)
|
||||
|
||||
def test():
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite())
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
unittest.main()
|
|
@ -305,22 +305,6 @@ class TextFactoryTestsWithEmbeddedZeroBytes(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
self.con.close()
|
||||
|
||||
def suite():
|
||||
tests = [
|
||||
ConnectionFactoryTests,
|
||||
CursorFactoryTests,
|
||||
RowFactoryTests,
|
||||
RowFactoryTestsBackwardsCompat,
|
||||
TextFactoryTests,
|
||||
TextFactoryTestsWithEmbeddedZeroBytes,
|
||||
]
|
||||
return unittest.TestSuite(
|
||||
[unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
|
||||
)
|
||||
|
||||
def test():
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite())
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
unittest.main()
|
|
@ -24,7 +24,7 @@ import unittest
|
|||
import sqlite3 as sqlite
|
||||
|
||||
from test.support.os_helper import TESTFN, unlink
|
||||
from .userfunctions import with_tracebacks
|
||||
from .test_userfunctions import with_tracebacks
|
||||
|
||||
class CollationTests(unittest.TestCase):
|
||||
def test_create_collation_not_string(self):
|
||||
|
@ -290,19 +290,5 @@ class TraceCallbackTests(unittest.TestCase):
|
|||
self.assertEqual(traced_statements, queries)
|
||||
|
||||
|
||||
def suite():
|
||||
tests = [
|
||||
CollationTests,
|
||||
ProgressTests,
|
||||
TraceCallbackTests,
|
||||
]
|
||||
return unittest.TestSuite(
|
||||
[unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
|
||||
)
|
||||
|
||||
def test():
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite())
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
unittest.main()
|
|
@ -436,17 +436,5 @@ class RegressionTests(unittest.TestCase):
|
|||
self.assertEqual(val, b'')
|
||||
|
||||
|
||||
def suite():
|
||||
tests = [
|
||||
RegressionTests
|
||||
]
|
||||
return unittest.TestSuite(
|
||||
[unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
|
||||
)
|
||||
|
||||
def test():
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite())
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
unittest.main()
|
|
@ -195,19 +195,6 @@ class TransactionalDDL(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
self.con.close()
|
||||
|
||||
def suite():
|
||||
tests = [
|
||||
SpecialCommandTests,
|
||||
TransactionTests,
|
||||
TransactionalDDL,
|
||||
]
|
||||
return unittest.TestSuite(
|
||||
[unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
|
||||
)
|
||||
|
||||
def test():
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite())
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
unittest.main()
|
|
@ -530,23 +530,6 @@ class DateTimeTests(unittest.TestCase):
|
|||
ts2 = self.cur.fetchone()[0]
|
||||
self.assertEqual(ts, ts2)
|
||||
|
||||
def suite():
|
||||
tests = [
|
||||
BinaryConverterTests,
|
||||
ColNamesTests,
|
||||
CommonTableExpressionTests,
|
||||
DateTimeTests,
|
||||
DeclTypesTests,
|
||||
ObjectAdaptationTests,
|
||||
SqliteTypeTests,
|
||||
]
|
||||
return unittest.TestSuite(
|
||||
[unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
|
||||
)
|
||||
|
||||
def test():
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite())
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
unittest.main()
|
|
@ -661,22 +661,5 @@ class AuthorizerLargeIntegerTests(AuthorizerTests):
|
|||
return sqlite.SQLITE_OK
|
||||
|
||||
|
||||
def suite():
|
||||
tests = [
|
||||
AggregateTests,
|
||||
AuthorizerIllegalTypeTests,
|
||||
AuthorizerLargeIntegerTests,
|
||||
AuthorizerRaiseExceptionTests,
|
||||
AuthorizerTests,
|
||||
FunctionTests,
|
||||
]
|
||||
return unittest.TestSuite(
|
||||
[unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
|
||||
)
|
||||
|
||||
def test():
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite())
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
||||
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue