fix(tests): fix create_template_db.py to create writable SQLite template database #9430
@@ -10,6 +10,7 @@ Usage:
|
||||
Default output: build/.template-migrated.db
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -62,6 +63,11 @@ def create_template(output_path: str = "build/.template-migrated.db") -> None:
|
||||
|
||||
engine.dispose()
|
||||
|
||||
# Ensure the template database is writable (0o664 = rw-rw-r--)
|
||||
# This prevents sqlite3.OperationalError: attempt to write a readonly database
|
||||
# when tests copy and modify the template during test setup.
|
||||
os.chmod(str(out), 0o664)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
path = sys.argv[1] if len(sys.argv) > 1 else "build/.template-migrated.db"
|
||||
|
||||
Reference in New Issue
Block a user