Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Fix run-single tests

Kilian Lieret060d499b488c
diff --git a/sweagent/__init__.py b/sweagent/__init__.py
index 167c7347..bf886d25 100644
--- a/sweagent/__init__.py
+++ b/sweagent/__init__.py
@@ -25,6 +25,9 @@ assert REPO_ROOT.is_dir()
CONFIG_DIR = PACKAGE_DIR.parent / "config"
assert CONFIG_DIR.is_dir()
+TOOLS_DIR = PACKAGE_DIR.parent / "tools"
+assert TOOLS_DIR.is_dir()
+
def get_agent_commit_hash() -> str:
repo = Repo(REPO_ROOT, search_parent_directories=True)
diff --git a/tests/test_run_single.py b/tests/test_run_single.py
index 2527c80b..57b8ca0d 100644
--- a/tests/test_run_single.py
+++ b/tests/test_run_single.py
@@ -4,6 +4,7 @@ from pathlib import Path
import pytest
+from sweagent import TOOLS_DIR
from sweagent.agent.agents import AgentConfig
from sweagent.agent.models import InstantEmptySubmitModelConfig
from sweagent.environment.swe_env import EnvironmentConfig
@@ -30,7 +31,8 @@ def test_run_single_raises_exception():
@pytest.fixture
def agent_config_with_commands():
ac = AgentConfig(model=InstantEmptySubmitModelConfig())
- ac.tools.command_files = [Path(f"config/commands/{name}") for name in ["submit.sh"]]
+ ac.tools.bundles = [TOOLS_DIR / "defaults", TOOLS_DIR / "submit"]
+ assert (TOOLS_DIR / "submit").exists()
# Make sure dependent properties are set
ac.tools.model_post_init(None)
return ac