Enable sqlite-backed tests#2
Enable sqlite-backed tests#2Aviat-at wants to merge 2 commits intofeature/backend-md-file-implementation-il0from
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async def _connect(database: str, **kwargs) -> Connection: | ||
| row_factory = kwargs.pop("row_factory", sqlite3.Row) | ||
| conn = await _run_in_thread(partial(sqlite3.connect, database, **kwargs)) | ||
| conn.row_factory = row_factory |
There was a problem hiding this comment.
Avoid dispatching sqlite connection across random threads
The stub creates the sqlite3 connection inside _connect and then routes every method call through asyncio.to_thread. Because the connection is created without check_same_thread=False, any call that happens to run on a different worker thread than the one that created the connection will raise sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The real aiosqlite pins a dedicated worker thread to prevent this. This wrapper needs to either create the connection with check_same_thread=False or queue all operations onto a single thread, otherwise async tests will fail unpredictably when the thread pool chooses a different worker.
Useful? React with 👍 / 👎.
…n, monitoring and logging guide, security policy, terraform guide, testing strategy, and roadmap for MapleCMS
Summary
aiosqliteimplementation and update models to use SQLite-friendly ID column types/JSON fieldsTesting
Codex Task