sqlite-utils/tests
Claude adfcbb4731
Support sqlite3.connect(autocommit=False) connections too
Database() now accepts all three Python transaction handling modes and
behaves identically in each. For autocommit=False connections - where
the driver holds an implicit transaction open at all times - the
library tracks transaction ownership itself:

- A new _explicit_transaction flag distinguishes transactions opened
  with begin()/atomic() from the driver's implicit one, exposed as a
  new db.in_transaction property (conn.in_transaction is always True
  in this mode)
- begin() claims the driver's implicit transaction instead of
  executing BEGIN, which the driver would reject; BEGIN/COMMIT/
  ROLLBACK passed to db.execute() are routed through begin()/commit()/
  rollback()
- Writes outside a user transaction commit the implicit transaction
  immediately, preserving the library's auto-commit contract
- Row-returning statements outside a transaction fetch eagerly and
  commit, so the implicit read transaction does not hold a shared
  lock that blocks writes from other connections
- PRAGMA and VACUUM run in temporary driver autocommit mode
  (ensure_autocommit_on() now flips conn.autocommit), since PRAGMAs
  are silently ignored and VACUUM refused inside the implicit
  transaction

A new pytest --sqlite-autocommit-false option runs the entire suite
in this mode, wired into CI alongside --sqlite-autocommit. Tests that
asserted on conn.in_transaction or wrote through db.conn without
committing now use the mode-aware library API instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFkrS2nuP8mo1jmT594VCd
2026-07-09 22:06:46 +00:00
..
sniff sqlite-utils insert --sniff option, closes #230 2021-02-14 11:23:12 -08:00
__init__.py Initial project layout + database table creation tools 2018-07-28 06:46:17 -07:00
conftest.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
ext.c Support entrypoints for --load-extension (#473) 2022-08-26 22:55:47 -07:00
test_analyze.py Use sqlean if available in environment (#560) 2023-06-25 16:25:51 -07:00
test_analyze_tables.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
test_atomic.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
test_attach.py db.attach(alias, filepath) method, closes #113 2021-02-18 20:56:32 -08:00
test_cli.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
test_cli_bulk.py --functions can take filenames, can be used multiple times (#681) 2025-11-23 21:46:51 -08:00
test_cli_convert.py JSON output no longer escapes non-ASCII characters, new --ascii option (#777) 2026-07-06 11:10:07 -07:00
test_cli_insert.py sqlite-utils insert/upsert --type colunm-name type option, closes #131 2026-07-07 19:17:29 -07:00
test_cli_memory.py Test for CSV headers with memory command, refs #702, #707 2026-06-21 16:05:10 -07:00
test_cli_migrate.py migrate --list is read-only with legacy sqlite-migrate classes too 2026-07-06 21:58:52 -07:00
test_column_affinity.py Tracer mechanism for showing underlying SQL queries 2020-09-07 14:56:59 -07:00
test_column_casing.py Match column names case-insensitively, closes #760 2026-07-05 22:11:22 -07:00
test_constructor.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
test_conversions.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_convert.py Raise ValueError instead of AssertionError for invalid arguments 2026-07-04 19:19:24 +00:00
test_create.py drop-index command and table.drop_index(index_name) 2026-07-07 21:00:43 -07:00
test_create_view.py Raise ValueError instead of AssertionError for invalid arguments 2026-07-04 19:19:24 +00:00
test_default_value.py Fix transform() corrupting TRUE/FALSE/NULL column defaults into strings 2026-07-05 22:33:55 -07:00
test_delete.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
test_docs.py More type annotations (#697) 2025-12-16 22:11:47 -08:00
test_duplicate.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00
test_enable_counts.py Use double quotes not braces for tables and columns (#678) 2025-11-23 20:43:26 -08:00
test_extract.py extract() no longer duplicates NULL-containing rows in shared lookups 2026-07-06 21:55:21 -07:00
test_extracts.py .extract() and .lookup() no longer extract null values, closes #186 2026-07-06 20:41:10 -07:00
test_foreign_keys.py add_foreign_keys() errors instead of silently dropping action changes 2026-07-06 21:53:48 -07:00
test_fts.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
test_get.py Refactored tests into new test_rows.py, refs #76 2020-04-15 18:04:55 -07:00
test_gis.py Apply Black to tests/test_gis.py 2026-07-05 21:17:41 -07:00
test_hypothesis.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_insert_files.py insert-files multiple --pk support, closes #621 2024-03-16 17:33:31 -07:00
test_introspect.py Compound primary keys now resolve in PRIMARY KEY declaration order 2026-07-06 21:34:02 -07:00
test_list_mode.py table.insert_all() and table.upsert_all() now take generators of lists/tuples 2025-11-23 12:17:23 -08:00
test_lookup.py .extract() and .lookup() no longer extract null values, closes #186 2026-07-06 20:41:10 -07:00
test_m2m.py Raise ValueError instead of AssertionError for invalid arguments 2026-07-04 19:19:24 +00:00
test_migrations.py migrate --stop-before an already-applied migration is now an error 2026-07-06 21:50:05 -07:00
test_plugins.py fix: Plugins are still loaded when running tests (#719) 2026-06-21 16:14:45 -07:00
test_query.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
test_recipes.py table.insert_all() and table.upsert_all() now take generators of lists/tuples 2025-11-23 12:17:23 -08:00
test_recreate.py Raise ValueError instead of AssertionError for invalid arguments 2026-07-04 19:19:24 +00:00
test_register_function.py Database as a context manager, fixed many pytest warnings 2025-12-11 16:56:12 -08:00
test_rows.py Fix two tests that assumed modern SQLite behavior 2026-07-06 22:02:41 -07:00
test_rows_from_file.py Type fixes now enforced by ty 2025-12-16 19:34:45 -08:00
test_sniff.py Fix PytestRemovedIn10Warning in test_sniff 2026-07-04 23:20:31 +00:00
test_suggest_column_types.py Fixed bug with null columns, closes #95 2020-03-23 13:31:06 -07:00
test_tracer.py Fix broken tracer test 2026-06-21 16:29:32 -07:00
test_transform.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00
test_update.py Use double quotes not braces for tables and columns (#678) 2025-11-23 20:43:26 -08:00
test_upsert.py upsert() now requires a value for every primary key column 2026-07-04 18:43:37 +00:00
test_utils.py Preserve duplicate column names in query results 2026-07-05 21:20:39 -07:00
test_wal.py Support sqlite3.connect(autocommit=False) connections too 2026-07-09 22:06:46 +00:00