@@ -326,11 +326,11 @@ async def test_timeout_message_includes_command(self, agent, mock_llm):
326326class TestWorkspaceIsolation :
327327 """Tests for workspace isolation between instances."""
328328
329- def test_different_instance_ids_get_different_paths (self ):
329+ def test_different_instance_ids_get_different_paths (self , tmp_path ):
330330 """Test that different instance_ids produce different workspace paths."""
331331 from nat_swe_bench .predictors .predict_iterative .tools .git_tool import get_repo_path
332332
333- workspace = "/tmp/ workspace"
333+ workspace = str ( tmp_path / " workspace")
334334 repo_url = "https://github.com/org/repo"
335335
336336 path1 = get_repo_path (workspace , repo_url , instance_id = "instance-001" )
@@ -340,11 +340,11 @@ def test_different_instance_ids_get_different_paths(self):
340340 assert "instance-001" in str (path1 )
341341 assert "instance-002" in str (path2 )
342342
343- def test_same_instance_id_gets_same_path (self ):
343+ def test_same_instance_id_gets_same_path (self , tmp_path ):
344344 """Test that the same instance_id always produces the same path."""
345345 from nat_swe_bench .predictors .predict_iterative .tools .git_tool import get_repo_path
346346
347- workspace = "/tmp/ workspace"
347+ workspace = str ( tmp_path / " workspace")
348348 repo_url = "https://github.com/org/repo"
349349 instance_id = "instance-001"
350350
@@ -353,22 +353,22 @@ def test_same_instance_id_gets_same_path(self):
353353
354354 assert path1 == path2
355355
356- def test_no_instance_id_uses_default_path (self ):
356+ def test_no_instance_id_uses_default_path (self , tmp_path ):
357357 """Test that no instance_id uses the default org/repo path."""
358358 from nat_swe_bench .predictors .predict_iterative .tools .git_tool import get_repo_path
359359
360- workspace = "/tmp/ workspace"
360+ workspace = str ( tmp_path / " workspace")
361361 repo_url = "https://github.com/myorg/myrepo"
362362
363363 path = get_repo_path (workspace , repo_url , instance_id = None )
364364
365- assert str (path ) == "/tmp/ workspace/myorg/myrepo"
365+ assert str (path ) == f" { workspace } /myorg/myrepo"
366366
367- def test_ssh_url_parsing (self ):
367+ def test_ssh_url_parsing (self , tmp_path ):
368368 """Test that SSH URLs are correctly parsed."""
369369 from nat_swe_bench .predictors .predict_iterative .tools .git_tool import get_repo_path
370370
371- workspace = "/tmp/ workspace"
371+ workspace = str ( tmp_path / " workspace")
372372 repo_url = "git@github.com:org/repo.git"
373373
374374 path = get_repo_path (workspace , repo_url , instance_id = "test-123" )
@@ -495,13 +495,13 @@ async def test_cleanup_handles_missing_directory(self, tmp_path):
495495 assert len (manager .active_repos ) == 0
496496
497497 @pytest .mark .asyncio
498- async def test_register_cleanup_error_handling (self ):
498+ async def test_register_cleanup_error_handling (self , tmp_path ):
499499 """Test that register.py cleanup handles errors gracefully."""
500500 from unittest .mock import AsyncMock
501501 from nat_swe_bench .predictors .predict_iterative .tools .git_tool import RepoManager
502502
503503 # Create a mock that raises an exception
504- manager = RepoManager ("/tmp/test" )
504+ manager = RepoManager (str ( tmp_path ) )
505505 manager .cleanup = AsyncMock (side_effect = Exception ("Cleanup failed" ))
506506
507507 # Verify that cleanup raises an exception (simulating failure)
@@ -590,7 +590,7 @@ async def test_clone_cleans_existing_path(self, tmp_path):
590590 target_path .mkdir ()
591591 (target_path / "existing_file.txt" ).write_text ("old content" )
592592
593- with patch ('nat_swe_bench.predictors.predict_iterative.tools.git_tool.Repo' ) as MockRepo :
593+ with patch ('nat_swe_bench.predictors.predict_iterative.tools.git_tool.Repo' ):
594594 mock_repo = MagicMock ()
595595
596596 with patch ('nat_swe_bench.predictors.predict_iterative.tools.git_tool.asyncio.wait_for' ) as mock_wait :
@@ -689,7 +689,7 @@ async def test_full_workflow_simulation(self, tmp_path):
689689 MagicMock (returncode = 0 , stdout = "COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT\n diff --git a/main.py\n -old\n +new" ),
690690 ]
691691
692- exit_status , patch_result = await agent .run ("Fix the bug in main.py" )
692+ exit_status , _patch_result = await agent .run ("Fix the bug in main.py" )
693693
694694 assert exit_status == "Submitted"
695695 assert agent .n_steps == 4
0 commit comments