From 62bf263a775f4444d8b5d5841cc09be3bd53e933 Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Sat, 30 Oct 2021 00:08:19 +0200 Subject: [PATCH] bpo-10572: Move `sqlite3` tests to `Lib/test` (GH-29304) Automerge-Triggered-By: GH:brettcannon --- Lib/sqlite3/test/__init__.py | 0 Lib/test/test_sqlite.py | 20 ------------------- Lib/test/test_sqlite3/__init__.py | 18 +++++++++++++++++ Lib/test/test_sqlite3/__main__.py | 5 +++++ .../test => test/test_sqlite3}/test_backup.py | 0 .../test => test/test_sqlite3}/test_dbapi.py | 0 .../test => test/test_sqlite3}/test_dump.py | 0 .../test_sqlite3}/test_factory.py | 0 .../test => test/test_sqlite3}/test_hooks.py | 0 .../test_sqlite3}/test_regression.py | 0 .../test_sqlite3}/test_transactions.py | 0 .../test => test/test_sqlite3}/test_types.py | 0 .../test_sqlite3}/test_userfunctions.py | 0 Makefile.pre.in | 1 - .../2021-01-07-01-25-38.bpo-10572.gEEZ9z.rst | 2 ++ PCbuild/lib.pyproj | 12 ++++++++++- 16 files changed, 36 insertions(+), 22 deletions(-) delete mode 100644 Lib/sqlite3/test/__init__.py delete mode 100644 Lib/test/test_sqlite.py create mode 100644 Lib/test/test_sqlite3/__init__.py create mode 100644 Lib/test/test_sqlite3/__main__.py rename Lib/{sqlite3/test => test/test_sqlite3}/test_backup.py (100%) rename Lib/{sqlite3/test => test/test_sqlite3}/test_dbapi.py (100%) rename Lib/{sqlite3/test => test/test_sqlite3}/test_dump.py (100%) rename Lib/{sqlite3/test => test/test_sqlite3}/test_factory.py (100%) rename Lib/{sqlite3/test => test/test_sqlite3}/test_hooks.py (100%) rename Lib/{sqlite3/test => test/test_sqlite3}/test_regression.py (100%) rename Lib/{sqlite3/test => test/test_sqlite3}/test_transactions.py (100%) rename Lib/{sqlite3/test => test/test_sqlite3}/test_types.py (100%) rename Lib/{sqlite3/test => test/test_sqlite3}/test_userfunctions.py (100%) create mode 100644 Misc/NEWS.d/next/Library/2021-01-07-01-25-38.bpo-10572.gEEZ9z.rst diff --git a/Lib/sqlite3/test/__init__.py b/Lib/sqlite3/test/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Lib/test/test_sqlite.py b/Lib/test/test_sqlite.py deleted file mode 100644 index 9992a02e5d9..00000000000 --- a/Lib/test/test_sqlite.py +++ /dev/null @@ -1,20 +0,0 @@ -import test.support -from test.support import import_helper -from test.support import load_package_tests - -# Skip test if _sqlite3 module not installed -import_helper.import_module('_sqlite3') - -import unittest -import os -import sqlite3.test - -def load_tests(loader, tests, pattern): - if test.support.verbose: - print("test_sqlite: testing with version", - "{!r}, sqlite_version {!r}".format(sqlite3.version, - sqlite3.sqlite_version)) - return load_package_tests(os.path.dirname(sqlite3.test.__file__), loader, tests, pattern) - -if __name__ == "__main__": - unittest.main() diff --git a/Lib/test/test_sqlite3/__init__.py b/Lib/test/test_sqlite3/__init__.py new file mode 100644 index 00000000000..099c01e3b3c --- /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 00000000000..51eddc3c2fd --- /dev/null +++ b/Lib/test/test_sqlite3/__main__.py @@ -0,0 +1,5 @@ +from test.test_sqlite3 import load_tests # Needed for the "load tests" protocol. +import unittest + +if __name__ == "__main__": + unittest.main() diff --git a/Lib/sqlite3/test/test_backup.py b/Lib/test/test_sqlite3/test_backup.py similarity index 100% rename from Lib/sqlite3/test/test_backup.py rename to Lib/test/test_sqlite3/test_backup.py diff --git a/Lib/sqlite3/test/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py similarity index 100% rename from Lib/sqlite3/test/test_dbapi.py rename to Lib/test/test_sqlite3/test_dbapi.py diff --git a/Lib/sqlite3/test/test_dump.py b/Lib/test/test_sqlite3/test_dump.py similarity index 100% rename from Lib/sqlite3/test/test_dump.py rename to Lib/test/test_sqlite3/test_dump.py diff --git a/Lib/sqlite3/test/test_factory.py b/Lib/test/test_sqlite3/test_factory.py similarity index 100% rename from Lib/sqlite3/test/test_factory.py rename to Lib/test/test_sqlite3/test_factory.py diff --git a/Lib/sqlite3/test/test_hooks.py b/Lib/test/test_sqlite3/test_hooks.py similarity index 100% rename from Lib/sqlite3/test/test_hooks.py rename to Lib/test/test_sqlite3/test_hooks.py diff --git a/Lib/sqlite3/test/test_regression.py b/Lib/test/test_sqlite3/test_regression.py similarity index 100% rename from Lib/sqlite3/test/test_regression.py rename to Lib/test/test_sqlite3/test_regression.py diff --git a/Lib/sqlite3/test/test_transactions.py b/Lib/test/test_sqlite3/test_transactions.py similarity index 100% rename from Lib/sqlite3/test/test_transactions.py rename to Lib/test/test_sqlite3/test_transactions.py diff --git a/Lib/sqlite3/test/test_types.py b/Lib/test/test_sqlite3/test_types.py similarity index 100% rename from Lib/sqlite3/test/test_types.py rename to Lib/test/test_sqlite3/test_types.py diff --git a/Lib/sqlite3/test/test_userfunctions.py b/Lib/test/test_sqlite3/test_userfunctions.py similarity index 100% rename from Lib/sqlite3/test/test_userfunctions.py rename to Lib/test/test_sqlite3/test_userfunctions.py diff --git a/Makefile.pre.in b/Makefile.pre.in index 322800ae26e..7c3c046f711 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1562,7 +1562,6 @@ TESTSUBDIRS= ctypes/test \ lib2to3/tests/data \ lib2to3/tests/data/fixers \ lib2to3/tests/data/fixers/myfixes \ - sqlite3/test \ test test/audiodata \ test/capath test/cjkencodings \ test/data test/decimaltestdata \ diff --git a/Misc/NEWS.d/next/Library/2021-01-07-01-25-38.bpo-10572.gEEZ9z.rst b/Misc/NEWS.d/next/Library/2021-01-07-01-25-38.bpo-10572.gEEZ9z.rst new file mode 100644 index 00000000000..45f44bcbb11 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-01-07-01-25-38.bpo-10572.gEEZ9z.rst @@ -0,0 +1,2 @@ +Move :mod:`sqlite3` tests to ``/Lib/test/test_sqlite3``. Patch by Erlend E. +Aasland. diff --git a/PCbuild/lib.pyproj b/PCbuild/lib.pyproj index 06e0a8b0d1c..43c570f1dab 100644 --- a/PCbuild/lib.pyproj +++ b/PCbuild/lib.pyproj @@ -1272,7 +1272,17 @@ - + + + + + + + + + + +