Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Lib/test/test_sqlite3/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from test.support import import_helper, load_package_tests, verbose

# Skip test if _sqlite3 module not installed.
import_helper.import_module('_sqlite3')

import unittest
import os
import sqlite3

# Implement the unittest "load tests" protocol.
def load_tests(*args):
pkg_dir = os.path.dirname(__file__)
return load_package_tests(pkg_dir, *args)

if verbose:
print("test_sqlite3: testing with version",
"{!r}, sqlite_version {!r}".format(sqlite3.version,
sqlite3.sqlite_version))
4 changes: 4 additions & 0 deletions Lib/test/test_sqlite3/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#from test.test_sqlite3 import load_tests
import unittest

unittest.main('test.test_sqlite3')
18 changes: 9 additions & 9 deletions Lib/test/test_sqlite3/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ def memory_database(*args, **kwargs):
return contextlib.closing(cx)


# Temporarily limit a database connection parameter
@contextlib.contextmanager
def cx_limit(cx, category=sqlite.SQLITE_LIMIT_SQL_LENGTH, limit=128):
try:
_prev = cx.setlimit(category, limit)
yield limit
finally:
cx.setlimit(category, _prev)
### Temporarily limit a database connection parameter
##@contextlib.contextmanager
##def cx_limit(cx, category=sqlite.SQLITE_LIMIT_SQL_LENGTH, limit=128):
## try:
## _prev = cx.setlimit(category, limit)
## yield limit
## finally:
## cx.setlimit(category, _prev)


class ModuleTests(unittest.TestCase):
Expand Down Expand Up @@ -1889,4 +1889,4 @@ def wait():


if __name__ == "__main__":
unittest.main()
unittest.main(verbosity=2)