@@ -194,33 +194,40 @@ def test_update_user_group(user_group):
194194
195195def test_get_user_groups_with_creation_deletion (client ):
196196 """Test user group creation, retrieval, and deletion."""
197- # Get initial count
198- initial_groups = list (UserGroup .get_user_groups (client ))
199- initial_count = len (initial_groups )
200-
201- # Create a new group
202197 group_name = f"{ data .name ()} _{ int (time .time ())} "
203198 user_group = UserGroup (client )
204199 user_group .name = group_name
205200 user_group .color = UserGroupColor .CYAN
206201 user_group .create ()
207202
208- # Verify the group was created
209- updated_groups = list (UserGroup .get_user_groups (client ))
210- assert len (updated_groups ) == initial_count + 1
211-
212- # Find our group
213- our_group = next ((g for g in updated_groups if g .name == group_name ), None )
214- assert our_group is not None
215- assert our_group .id == user_group .id
203+ # Verify the created group appears in the listing (retry for eventual
204+ # consistency; count-based checks are racy with parallel test workers).
205+ our_group = None
206+ for _ in range (5 ):
207+ updated_groups = list (UserGroup .get_user_groups (client ))
208+ our_group = next (
209+ (g for g in updated_groups if g .id == user_group .id ), None
210+ )
211+ if our_group is not None :
212+ break
213+ time .sleep (2 )
214+ assert (
215+ our_group is not None
216+ ), f"Created group { user_group .id } not found in group listing"
217+ assert our_group .name == group_name
216218
217219 # Delete the group
218220 user_group .delete ()
219221
220- # Verify the group was deleted
221- final_groups = list (UserGroup .get_user_groups (client ))
222- assert len (final_groups ) == initial_count
223- assert len (user_group .members ) == 0 # V3 uses members
222+ # Verify the deleted group no longer appears in the listing
223+ gone = False
224+ for _ in range (5 ):
225+ final_groups = list (UserGroup .get_user_groups (client ))
226+ if not any (g .id == user_group .id for g in final_groups ):
227+ gone = True
228+ break
229+ time .sleep (2 )
230+ assert gone , f"Deleted group { user_group .id } still appears in group listing"
224231
225232
226233def test_update_user_group_members_projects (user_group , client , project_pack ):
0 commit comments