Skip to content

[3.10] gh-94998: Make 3.10 sqlite3 tests run #95015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
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)