mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-27 11:24:33 +02:00
fix: defer plugin entrypoint loading until runtime
Fixes simonw/sqlite-utils#713
This commit is contained in:
parent
8d74ffc932
commit
974fe2f82f
3 changed files with 11 additions and 4 deletions
|
|
@ -6,10 +6,15 @@ from . import hookspecs
|
|||
|
||||
pm: pluggy.PluginManager = pluggy.PluginManager("sqlite_utils")
|
||||
pm.add_hookspecs(hookspecs)
|
||||
_plugins_loaded = False
|
||||
|
||||
if not getattr(sys, "_called_from_test", False):
|
||||
# Only load plugins if not running tests
|
||||
|
||||
def ensure_plugins_loaded() -> None:
|
||||
global _plugins_loaded
|
||||
if _plugins_loaded or getattr(sys, "_called_from_test", False):
|
||||
return
|
||||
pm.load_setuptools_entrypoints("sqlite_utils")
|
||||
_plugins_loaded = True
|
||||
|
||||
|
||||
def get_plugins() -> List[Dict[str, Union[str, List[str]]]]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue