1414
1515
1616def test_apply_plan_adds_to_memory (monkeypatch ):
17- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
18-
1917 class DummyModel (Model ):
2018 def __init__ (self ):
2119 super ().__init__ (seed = 42 )
@@ -70,8 +68,6 @@ def add_agent(self, pos):
7068
7169
7270def test_generate_obs_with_one_neighbor (monkeypatch ):
73- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
74-
7571 class DummyModel (Model ):
7672 def __init__ (self ):
7773 super ().__init__ (seed = 45 )
@@ -128,8 +124,6 @@ def add_agent(self, pos, agent_class=LLMAgent):
128124
129125
130126def test_send_message_updates_both_agents_memory (monkeypatch ):
131- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
132-
133127 class DummyModel (Model ):
134128 def __init__ (self ):
135129 super ().__init__ (seed = 45 )
@@ -187,8 +181,6 @@ def fake_add_to_memory(*args, **kwargs):
187181
188182@pytest .mark .asyncio
189183async def test_aapply_plan_adds_to_memory (monkeypatch ):
190- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
191-
192184 class DummyModel (Model ):
193185 def __init__ (self ):
194186 super ().__init__ (seed = 42 )
@@ -236,8 +228,6 @@ async def fake_acall_tools(agent, llm_response):
236228
237229@pytest .mark .asyncio
238230async def test_agenerate_obs_with_one_neighbor (monkeypatch ):
239- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
240-
241231 class DummyModel (Model ):
242232 def __init__ (self ):
243233 super ().__init__ (seed = 45 )
@@ -285,8 +275,6 @@ async def fake_aadd_to_memory(*args, **kwargs):
285275
286276@pytest .mark .asyncio
287277async def test_async_wrapper_calls_pre_and_post (monkeypatch ):
288- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
289-
290278 class CustomAgent (LLMAgent ):
291279 async def astep (self ):
292280 self .user_called = True
@@ -350,7 +338,6 @@ def _make_agent(model, vision=0, internal_state=None):
350338
351339def test_safer_cell_access_agent_with_cell_no_pos (monkeypatch ):
352340 """Agent location falls back to cell.coordinate when pos=None."""
353- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
354341 model = Model (seed = 42 )
355342 agent = _make_agent (model )
356343 agent .pos = None
@@ -364,7 +351,6 @@ def test_safer_cell_access_agent_with_cell_no_pos(monkeypatch):
364351
365352def test_safer_cell_access_agent_without_cell_or_pos (monkeypatch ):
366353 """Agent location returns None gracefully when neither pos nor cell exists."""
367- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
368354 model = Model (seed = 42 )
369355 agent = _make_agent (model )
370356 agent .pos = None
@@ -379,7 +365,6 @@ def test_safer_cell_access_agent_without_cell_or_pos(monkeypatch):
379365
380366def test_safer_cell_access_neighbor_with_cell_no_pos (monkeypatch ):
381367 """Neighbor position uses cell.coordinate when neighbor.pos=None."""
382- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
383368
384369 class GridModel (Model ):
385370 def __init__ (self ):
@@ -413,7 +398,6 @@ def __init__(self):
413398
414399def test_safer_cell_access_neighbor_without_cell_or_pos (monkeypatch ):
415400 """Neighbor position returns None when neighbor has neither pos nor cell."""
416- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
417401
418402 class GridModel (Model ):
419403 def __init__ (self ):
@@ -448,7 +432,6 @@ def __init__(self):
448432
449433def test_generate_obs_with_continuous_space (monkeypatch ):
450434 """Agents within vision radius are included; those outside are not."""
451- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
452435
453436 class ContModel (Model ):
454437 def __init__ (self ):
@@ -485,7 +468,6 @@ def __init__(self):
485468
486469def test_generate_obs_vision_all_agents (monkeypatch ):
487470 """vision=-1 returns all other agents regardless of position."""
488- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
489471
490472 class GridModel (Model ):
491473 def __init__ (self ):
@@ -519,7 +501,6 @@ def __init__(self):
519501
520502def test_generate_obs_no_grid_with_vision (monkeypatch ):
521503 """When the model has no grid/space, generate_obs falls back to empty neighbors."""
522- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
523504 model = Model (seed = 42 ) # no grid, no space
524505 agents = LLMAgent .create_agents (
525506 model ,
@@ -549,7 +530,6 @@ def test_generate_obs_standard_grid_with_vision_radius(monkeypatch):
549530 - The observation includes nearby agents in local_state.
550531 - The SingleGrid neighbor lookup branch is executed.
551532 """
552- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
553533
554534 class GridModel (Model ):
555535 def __init__ (self ):
@@ -585,7 +565,6 @@ def test_generate_obs_orthogonal_grid_branches(monkeypatch):
585565 Covers Orthogonal grid-specific branches including
586566 cell-based lookup and fallback behavior.
587567 """
588- monkeypatch .setenv ("GEMINI_API_KEY" , "dummy" )
589568
590569 class OrthoModel (Model ):
591570 def __init__ (self ):
0 commit comments