More robust _called_from_test pattern

This commit is contained in:
Simon Willison 2023-07-22 16:21:27 -07:00
commit 778dad789e
2 changed files with 3 additions and 2 deletions

View file

@ -3106,7 +3106,8 @@ def plugins_list():
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):