Skip to content

Commit 778dad7

Browse files
committed
More robust _called_from_test pattern
1 parent e337a88 commit 778dad7

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

sqlite_utils/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3106,7 +3106,8 @@ def plugins_list():
31063106
click.echo(json.dumps(get_plugins(), indent=2))
31073107

31083108

3109-
pm.hook.register_commands(cli=cli)
3109+
if not getattr(sys, "_called_from_test", False):
3110+
pm.hook.register_commands(cli=cli)
31103111

31113112

31123113
def _render_common(title, values):

sqlite_utils/plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
pm = pluggy.PluginManager("sqlite_utils")
66
pm.add_hookspecs(hookspecs)
77

8-
if not hasattr(sys, "_called_from_test"):
8+
if not getattr(sys, "_called_from_test", False):
99
# Only load plugins if not running tests
1010
pm.load_setuptools_entrypoints("sqlite_utils")
1111

0 commit comments

Comments
 (0)