From 4be2bbdc0efdcd0e5fe2c7fabb4844bb61ec0a10 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 19 May 2025 19:03:26 -0400 Subject: [PATCH] Ensure test does not fail due to random sort order of plugins --- tests/test_plugins.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_plugins.py b/tests/test_plugins.py index b9b56c1..9efd498 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -296,13 +296,16 @@ def test_plugins_command(): runner = CliRunner() result = runner.invoke(cli.cli, ["plugins"]) assert result.exit_code == 0 - assert json.loads(result.output) == [ + expected = [ {"name": "EchoModelPlugin", "hooks": ["register_models"]}, { "name": "MockModelsPlugin", "hooks": ["register_embedding_models", "register_models"], }, ] + actual = json.loads(result.output) + actual.sort(key=lambda p: p["name"]) + assert actual == expected # Test the --hook option result2 = runner.invoke(cli.cli, ["plugins", "--hook", "register_embedding_models"]) assert result2.exit_code == 0