diff --git a/tests/test_collection.py b/tests/test_collection.py index 5055ea593..baa71a4ac 100755 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -82,61 +82,77 @@ def test_metadata(self): ) def test_list(self): - for coll_name in collections: + def test(coll_name): coll = getattr(self.service, coll_name) expected = [ent.name for ent in coll.list(count=10, sort_mode="auto")] - if len(expected) == 0: - logging.debug(f"No entities in collection {coll_name}; skipping test.") found = [ent.name for ent in coll.list()][:10] - self.assertEqual( - expected, - found, - msg=f"on {coll_name} (expected: {expected}, found: {found})", - ) + if expected != found: + logging.warning( + f"on {coll_name} (expected: {expected}, found: {found})", + ) + return False + + return True - def test_list_with_count(self): - N = 5 for coll_name in collections: + self.assertEventuallyTrue(lambda: test(coll_name)) + + def test_list_with_count(self): + def test(coll_name): + N = 5 coll = getattr(self.service, coll_name) expected = [ent.name for ent in coll.list(count=N + 5)][:N] N = len(expected) # in case there are