Skip to content

Commit 061b8ef

Browse files
committed
Update test_concurrent_island_access.py
1 parent 88351c9 commit 061b8ef

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/test_concurrent_island_access.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,23 @@ def sample_from_island(island_id):
122122
print("⚠️ Race condition not reproduced - may need more iterations or different timing")
123123

124124
def test_sequential_island_access_works_correctly(self):
125-
"""Test that sequential access works without issues"""
125+
"""Test that sequential access works without issues using safe sampling"""
126126
results = []
127127

128128
for island_id in range(5):
129-
original_island = self.database.current_island
130-
self.database.current_island = island_id
131-
132129
try:
133-
parent, inspirations = self.database.sample(num_inspirations=2)
130+
parent, inspirations = self.database.sample_from_island(island_id, num_inspirations=2)
134131
actual_island = parent.metadata.get("island", -1)
135132
results.append({
136133
"requested": island_id,
137134
"actual": actual_island
138135
})
139-
finally:
140-
self.database.current_island = original_island
136+
except Exception as e:
137+
print(f"Error sampling from island {island_id}: {e}")
138+
results.append({
139+
"requested": island_id,
140+
"actual": -1 # Indicate error
141+
})
141142

142143
# All sequential accesses should work correctly
143144
for result in results:

0 commit comments

Comments
 (0)