From b42b4ee44c56b71d5f89aea3067ebf70d5f4fa49 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 19 Jul 2022 13:30:43 -0400 Subject: [PATCH] gh-94998: Make 3.10 sqlite3 tests run Add __init__ and __main__ to test_sqlite3 directory. In test_dbapi, comment out cx_limit, line 42. Add 'verbosity=2' to unittest.main(). --- Lib/test/test_sqlite3/__init__.py | 18 ++++++++++++++++++ Lib/test/test_sqlite3/__main__.py | 4 ++++ Lib/test/test_sqlite3/test_dbapi.py | 18 +++++++++--------- 3 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 Lib/test/test_sqlite3/__init__.py create mode 100644 Lib/test/test_sqlite3/__main__.py diff --git a/Lib/test/test_sqlite3/__init__.py b/Lib/test/test_sqlite3/__init__.py new file mode 100644 index 00000000000000..099c01e3b3cc70 --- /dev/null +++ b/Lib/test/test_sqlite3/__init__.py @@ -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)) diff --git a/Lib/test/test_sqlite3/__main__.py b/Lib/test/test_sqlite3/__main__.py new file mode 100644 index 00000000000000..b10a54aa15272e --- /dev/null +++ b/Lib/test/test_sqlite3/__main__.py @@ -0,0 +1,4 @@ +#from test.test_sqlite3 import load_tests +import unittest + +unittest.main('test.test_sqlite3') diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 18e84e9e58632b..7a7b3ca587f386 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -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): @@ -1889,4 +1889,4 @@ def wait(): if __name__ == "__main__": - unittest.main() + unittest.main(verbosity=2) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy