datasette/tests
Claude 1ff4e67b79
Make execute_write_script transactional, matching its documentation
execute_write_script() was documented as running inside a transaction
but actually passed transaction=False and used conn.executescript(),
which commits each statement as it executes - a failing script could
half-apply.

Scripts are now split into complete statements (via
sqlite3.complete_statement) and executed one at a time inside the task
transaction, so a failing script applies nothing. Scripts containing
statements that cannot run in a transaction (VACUUM, ATTACH, DETACH,
PRAGMA) or that manage transactions themselves (BEGIN, COMMIT,
SAVEPOINT etc) keep the previous executescript() autocommit behavior.

Refs #2831

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N76afGMhBRQk528VF1LTpR
2026-07-09 05:54:02 +00:00
..
plugins Support for <button> items in action menus 2026-06-14 15:58:37 -07:00
test_templates
__init__.py
build_small_spatialite_db.py
conftest.py Isolate Unix domain socket test server paths 2026-06-22 10:11:56 -07:00
ext.c
fixtures.py
spatialite.db
test-datasette-load-plugins.sh
test_actions_sql.py
test_actor_restriction_bug.py
test_allowed_many.py Switch to CTE to handle 600+ actions at once 2026-06-13 11:09:28 -07:00
test_allowed_resources.py
test_api.py Return 400 not 500 for wrong-arity composite-PK row URLs (#2815) 2026-07-07 14:19:08 -07:00
test_api_write.py Upgrade to sqlite-utils 4.0 2026-07-07 13:57:06 -07:00
test_auth.py Return 401 for invalid or expired bearer tokens 2026-07-04 15:18:12 +00:00
test_autocomplete.py Add "ok": true to every JSON object success response 2026-07-04 13:40:05 +00:00
test_base_view.py Unify JSON error responses into one canonical shape 2026-07-04 03:12:15 +00:00
test_cli.py Return canonical JSON error for Forbidden on JSON requests 2026-07-04 14:09:10 +00:00
test_cli_serve_get.py Add "ok": true to every JSON object success response 2026-07-04 13:40:05 +00:00
test_cli_serve_server.py
test_column_types.py Write endpoints parse the body as JSON regardless of Content-Type 2026-07-06 23:20:47 +00:00
test_config_dir.py Convert /-/databases.json from top-level array to object 2026-07-04 13:43:44 +00:00
test_config_permission_rules.py
test_crossdb.py
test_csrf_middleware.py
test_csv.py
test_custom_pages.py Prevent open redirect via backslash in path (#2680) 2026-06-10 23:36:28 -07:00
test_datasette_https_server.sh More robust test_datasette_https_server.sh test 2026-06-22 10:11:56 -07:00
test_debug_autocomplete.py Autocomplete widget and /-/debug/autocomplete test page 2026-06-13 22:59:37 -07:00
test_default_deny.py Add regression test for --default-deny index 500 (#2644) 2026-06-10 23:36:28 -07:00
test_docs.py Add "ok": true to every JSON object success response 2026-07-04 13:40:05 +00:00
test_docs_plugins.py
test_error_shape.py Remove the next_url extra - the key is always present 2026-07-06 23:59:53 +00:00
test_extras.py Context.documented_fields() and extras doc-metadata enforcement 2026-06-11 07:47:15 -07:00
test_facets.py
test_fd_leak.py
test_filters.py
test_fixtures.py
test_html.py Unify page-size parameters on _size with table semantics 2026-07-04 17:54:03 +00:00
test_internal_db.py Switch to sqlite-utils migrations for internal.db, closes #2827 2026-07-07 13:58:48 -07:00
test_internals_database.py Make execute_write_script transactional, matching its documentation 2026-07-09 05:54:02 +00:00
test_internals_datasette.py Require permissions-debug for /-/threads 2026-07-04 16:22:41 +00:00
test_internals_datasette_client.py Add "ok": true to every JSON object success response 2026-07-04 13:40:05 +00:00
test_internals_request.py max_post_body_bytes setting, enforced for reuest.post_body() 2026-07-03 17:42:39 -07:00
test_internals_response.py Add Response.error() for JSON errors in the standard format 2026-07-06 23:48:49 +00:00
test_internals_urls.py Renamed base_url parameter to ds_base_url in tests 2026-06-16 14:25:42 -07:00
test_jump.py Autocomplete widget and /-/debug/autocomplete test page 2026-06-13 22:59:37 -07:00
test_label_column_for_table.py
test_load_extensions.py
test_messages.py
test_multipart.py
test_package.py
test_permission_endpoints.py Unify page-size parameters on _size with table semantics 2026-07-04 17:54:03 +00:00
test_permissions.py Use UNSTABLE_API_MESSAGE constant in tests 2026-07-07 05:18:54 +00:00
test_playwright.py Make binary playwright test more robust 2026-07-05 22:46:00 -07:00
test_plugins.py Convert /-/plugins.json from top-level array to object 2026-07-04 13:42:24 +00:00
test_publish_cloudrun.py
test_publish_heroku.py
test_pytest_autoclose_plugin.py
test_queries.py Remove test_query_list_json_signals_pagination_via_next_only 2026-07-07 05:18:54 +00:00
test_restriction_sql.py
test_routes.py Convert /-/databases.json from top-level array to object 2026-07-04 13:43:44 +00:00
test_schema_endpoints.py
test_search_tables.py
test_spatialite.py
test_stored_queries.py Fix write query failing when a named parameter is called :sql (#2765) 2026-06-10 20:15:03 -07:00
test_success_envelope.py Use UNSTABLE_API_MESSAGE constant in tests 2026-07-07 05:18:54 +00:00
test_table_api.py Remove the next_url extra - the key is always present 2026-07-06 23:59:53 +00:00
test_table_html.py Merge remote-tracking branch 'origin/main' into claude/json-api-docs-1-0-review-a3e83u 2026-07-06 22:25:27 +00:00
test_template_context.py Remove count truncated context test 2026-06-23 12:29:21 -07:00
test_token_handler.py Return 401 for invalid or expired bearer tokens 2026-07-04 15:18:12 +00:00
test_tracer.py Fix for trace_child_tasks exception handling 2026-06-12 13:21:58 -07:00
test_utils.py A few more SQLite string fixes, refs #2783 2026-07-07 14:26:34 -07:00
test_utils_check_callable.py
test_utils_permissions.py
test_utils_sql_analysis.py
test_write_sql_operation_decisions.py
test_write_wrapper.py
utils.py