From 56865505ec6e7b978cd38306d13f8b9c935ec6a3 Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Thu, 25 Jul 2024 14:14:58 +0200 Subject: [PATCH] Fix flaky organization model test Compare sets instead of list to avoid any issues around ordering. --- tests/unit/lms/models/organization_test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unit/lms/models/organization_test.py b/tests/unit/lms/models/organization_test.py index 6656ffc8ec..1529b24829 100644 --- a/tests/unit/lms/models/organization_test.py +++ b/tests/unit/lms/models/organization_test.py @@ -19,7 +19,10 @@ def test_application_instance_relationship( ): db_session.flush() - assert organization.application_instances == application_instances + by_id = lambda x: x.id + assert sorted(organization.application_instances, key=by_id) == sorted( + application_instances, key=by_id + ) for application_instance in application_instances: assert application_instance.organization == organization