mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-02 15:34:10 +02:00
fix: Plugins are still loaded when running tests (#719)
* fix: defer plugin entrypoint loading until runtime Fixes simonw/sqlite-utils#713 * Lazy-load plugins when listing them Keep plugin entrypoints from loading at module import time, but preserve the existing behavior of get_plugins() by loading entrypoints the first time plugins are listed outside tests. --------- Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
parent
733a67490f
commit
f448b61f5e
4 changed files with 43 additions and 4 deletions
|
|
@ -41,7 +41,7 @@ from typing import (
|
|||
Tuple,
|
||||
)
|
||||
import uuid
|
||||
from sqlite_utils.plugins import pm
|
||||
from sqlite_utils.plugins import ensure_plugins_loaded, pm
|
||||
|
||||
try:
|
||||
iterdump = importlib.import_module("sqlite_dump").iterdump
|
||||
|
|
@ -401,6 +401,7 @@ class Database:
|
|||
self._registered_functions: set = set()
|
||||
self.use_counts_table = use_counts_table
|
||||
if execute_plugins:
|
||||
ensure_plugins_loaded()
|
||||
pm.hook.prepare_connection(conn=self.conn)
|
||||
self.strict = strict
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue