mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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:
parent
8db451ceb1
commit
0e8b3fc718
4 changed files with 73 additions and 100 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue