gh-108550: Speed up sqlite3 tests (#108551)

Refactor the CLI so we can easily invoke it and mock command-line
arguments. Adapt the CLI tests so we no longer have to launch a
separate process.

Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

The sqlite3 test suite now completes ~8 times faster than before.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Erlend E. Aasland 2023-08-28 14:17:34 +02:00 committed by GitHub
parent 8db451ceb1
commit 0e8b3fc718
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 100 deletions

View file

@ -62,7 +62,7 @@ class SqliteInteractiveConsole(InteractiveConsole):
return False
def main():
def main(*args):
parser = ArgumentParser(
description="Python sqlite3 CLI",
prog="python -m sqlite3",
@ -86,7 +86,7 @@ def main():
version=f"SQLite version {sqlite3.sqlite_version}",
help="Print underlying SQLite library version",
)
args = parser.parse_args()
args = parser.parse_args(*args)
if args.filename == ":memory:":
db_name = "a transient in-memory database"
@ -120,5 +120,8 @@ def main():
finally:
con.close()
sys.exit(0)
main()
if __name__ == "__main__":
main(sys.argv)