mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-10-01 22:34:14 +02:00
More robust _called_from_test pattern
This commit is contained in:
parent
e337a88b45
commit
778dad789e
2 changed files with 3 additions and 2 deletions
|
|
@ -3106,7 +3106,8 @@ def plugins_list():
|
||||||
click.echo(json.dumps(get_plugins(), indent=2))
|
click.echo(json.dumps(get_plugins(), indent=2))
|
||||||
|
|
||||||
|
|
||||||
pm.hook.register_commands(cli=cli)
|
if not getattr(sys, "_called_from_test", False):
|
||||||
|
pm.hook.register_commands(cli=cli)
|
||||||
|
|
||||||
|
|
||||||
def _render_common(title, values):
|
def _render_common(title, values):
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from . import hookspecs
|
||||||
pm = pluggy.PluginManager("sqlite_utils")
|
pm = pluggy.PluginManager("sqlite_utils")
|
||||||
pm.add_hookspecs(hookspecs)
|
pm.add_hookspecs(hookspecs)
|
||||||
|
|
||||||
if not hasattr(sys, "_called_from_test"):
|
if not getattr(sys, "_called_from_test", False):
|
||||||
# Only load plugins if not running tests
|
# Only load plugins if not running tests
|
||||||
pm.load_setuptools_entrypoints("sqlite_utils")
|
pm.load_setuptools_entrypoints("sqlite_utils")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue