diff options
author | Erlend E. Aasland <erlend@python.org> | 2023-08-28 12:17:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-28 12:17:34 (GMT) |
commit | 0e8b3fc718c8a1c4de558c553d9e05049c1dbec6 (patch) | |
tree | 34e24ddfcc25abbfaa5ff350f15156797cc8d1d0 /Lib/sqlite3 | |
parent | 8db451ceb17cf8ec92c8aed2e0a41c78d07f9f45 (diff) | |
download | cpython-0e8b3fc718c8a1c4de558c553d9e05049c1dbec6.zip cpython-0e8b3fc718c8a1c4de558c553d9e05049c1dbec6.tar.gz cpython-0e8b3fc718c8a1c4de558c553d9e05049c1dbec6.tar.bz2 |
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>
Diffstat (limited to 'Lib/sqlite3')
-rw-r--r-- | Lib/sqlite3/__main__.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/sqlite3/__main__.py b/Lib/sqlite3/__main__.py index 3228dbc..10a2e9e 100644 --- a/Lib/sqlite3/__main__.py +++ b/Lib/sqlite3/__main__.py @@ -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) |