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]
CI: Update test repo location (#672)
Kilian Lierete692e9122cfe
diff --git a/tests/conftest.py b/tests/conftest.pyindex 03563c03..8d1fcaf9 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -39,8 +39,8 @@ def test_data_sources_path(test_data_path) -> Path:def test_trajectory_path(test_trajectories_path) -> Path:traj = (test_trajectories_path- / "gpt4__klieret__swe-agent-test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1"- / "klieret__swe-agent-test-repo-i1.traj"+ / "gpt4__swe-agent__test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1"+ / "swe-agent__test-repo-i1.traj")assert traj.exists()return trajdiff --git a/tests/test_data/trajectories/gpt4__klieret__swe-agent-test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml b/tests/test_data/trajectories/gpt4__swe-agent__test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yamlsimilarity index 100%rename from tests/test_data/trajectories/gpt4__klieret__swe-agent-test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yamlrename to tests/test_data/trajectories/gpt4__swe-agent__test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yamldiff --git a/tests/test_data/trajectories/gpt4__klieret__swe-agent-test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/klieret__swe-agent-test-repo-i1.traj b/tests/test_data/trajectories/gpt4__swe-agent__test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/swe-agent__test-repo-i1.trajsimilarity index 100%rename from tests/test_data/trajectories/gpt4__klieret__swe-agent-test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/klieret__swe-agent-test-repo-i1.trajrename to tests/test_data/trajectories/gpt4__swe-agent__test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/swe-agent__test-repo-i1.trajdiff --git a/tests/test_env.py b/tests/test_env.pyindex 99e0c75b..58f9169e 100644--- a/tests/test_env.py+++ b/tests/test_env.py@@ -21,8 +21,8 @@ def test_env_args(tmpdir_factory,):"""This will use a persistent container"""- local_repo_path = tmpdir_factory.getbasetemp() / "swe-agent-test-repo"- clone_cmd = ["git", "clone", "https://github.com/klieret/swe-agent-test-repo", local_repo_path]+ local_repo_path = tmpdir_factory.getbasetemp() / "test-repo"+ clone_cmd = ["git", "clone", "https://github.com/swe-agent/test-repo", local_repo_path]subprocess.run(clone_cmd, check=True)data_path = local_repo_path / "problem_statements" / "1.md"test_env_args = EnvironmentArguments(@@ -175,7 +175,7 @@ def test_execute_environment_clone_python(tmp_path, test_env_args, capsys):def test_open_pr(test_env_args):test_env_args = dataclasses.replace(test_env_args,- data_path="https://github.com/klieret/swe-agent-test-repo/issues/1",+ data_path="https://github.com/swe-agent/test-repo/issues/1",repo_path="",)with swe_env_context(test_env_args) as env:diff --git a/tests/test_env_utils.py b/tests/test_env_utils.pyindex a4da24b8..0dbfc009 100644--- a/tests/test_env_utils.py+++ b/tests/test_env_utils.py@@ -86,10 +86,10 @@ def test_get_associated_commit_urls():def test_get_instance_gh_issue():- instance = get_instances("https://github.com/klieret/swe-agent-test-repo/issues/1", **_TOKEN)[0]+ instance = get_instances("https://github.com/swe-agent/test-repo/issues/1", **_TOKEN)[0]compare_with = {- "repo": "klieret/swe-agent-test-repo",- "instance_id": "klieret__swe-agent-test-repo-i1",+ "repo": "swe-agent/test-repo",+ "instance_id": "swe-agent__test-repo-i1","repo_type": "github",}for key in compare_with:@@ -109,16 +109,16 @@ def clone_repo(tmp_path, repo_url):def test_get_instance_gh_issue_local_repo(tmp_path):- clone_repo(tmp_path, "https://github.com/klieret/swe-agent-test-repo/")+ clone_repo(tmp_path, "https://github.com/swe-agent/test-repo/")instance = get_instances(- file_path="https://github.com/klieret/swe-agent-test-repo/issues/1",- repo_path=str(tmp_path / "swe-agent-test-repo"),+ file_path="https://github.com/swe-agent/test-repo/issues/1",+ repo_path=str(tmp_path / "test-repo"),**_TOKEN,)[0]compare_with = {- "repo": str(tmp_path.resolve() / "swe-agent-test-repo"),+ "repo": str(tmp_path.resolve() / "test-repo"),"repo_type": "local",- "instance_id": "klieret__swe-agent-test-repo-i1",+ "instance_id": "swe-agent__test-repo-i1",}for key in compare_with:assert instance[key] == compare_with[key]@@ -128,15 +128,15 @@ def test_get_instance_gh_issue_local_repo(tmp_path):def test_get_instance_local_issue_local_repo(tmp_path):- clone_repo(tmp_path, "https://github.com/klieret/swe-agent-test-repo/")+ clone_repo(tmp_path, "https://github.com/swe-agent/test-repo/")issue_path = tmp_path / "issue.txt"issue_path.write_text("asdf")instance = get_instances(file_path=str(issue_path),- repo_path=str(tmp_path / "swe-agent-test-repo"),+ repo_path=str(tmp_path / "test-repo"),)[0]compare_with = {- "repo": str(tmp_path.resolve() / "swe-agent-test-repo"),+ "repo": str(tmp_path.resolve() / "test-repo"),"repo_type": "local","instance_id": hashlib.sha256(b"asdf").hexdigest()[:6],"problem_statement": "asdf",@@ -149,14 +149,14 @@ def test_get_instance_local_issue_local_repo(tmp_path):def test_get_instance_gh_issue_gh_repo(tmp_path):instance = get_instances(- file_path="https://github.com/klieret/swe-agent-test-repo/issues/1",+ file_path="https://github.com/swe-agent/test-repo/issues/1",repo_path="https://github.com/princeton-nlp/SWE-agent",**_TOKEN,)[0]compare_with = {"repo": "princeton-nlp/SWE-agent","repo_type": "github",- "instance_id": "klieret__swe-agent-test-repo-i1",+ "instance_id": "swe-agent__test-repo-i1",}for key in compare_with:assert instance[key] == compare_with[key]diff --git a/tests/test_replay.py b/tests/test_replay.pyindex d2ff7bd9..558633dc 100644--- a/tests/test_replay.py+++ b/tests/test_replay.py@@ -11,8 +11,8 @@ from sweagent import CONFIG_DIR@pytest.fixture()def swe_agent_test_repo_clone(tmp_path):- local_repo_path = tmp_path / "swe-agent-test-repo"- clone_cmd = ["git", "clone", "https://github.com/klieret/swe-agent-test-repo", local_repo_path]+ local_repo_path = tmp_path / "test-repo"+ clone_cmd = ["git", "clone", "https://github.com/swe-agent/test-repo", local_repo_path]subprocess.run(clone_cmd, check=True)return local_repo_path@@ -44,7 +44,7 @@ def test_model_replay_github_repo(swe_agent_test_repo_local_problem_stmt,):if problem_statement_source == "github":- data_path = "https://github.com/klieret/swe-agent-test-repo/issues/1"+ data_path = "https://github.com/swe-agent/test-repo/issues/1"elif problem_statement_source == "local":data_path = str(swe_agent_test_repo_local_problem_stmt)args = [@@ -57,7 +57,7 @@ def test_model_replay_github_repo("--raise_exceptions",]if problem_statement_source == "local":- args.extend(["--repo_path", "https://github.com/klieret/swe-agent-test-repo/"])+ args.extend(["--repo_path", "https://github.com/swe-agent/test-repo/"])args, remaining_args = get_args(args)with tmpdir.as_cwd():# Test that we can run run.py also independently from repo dir@@ -101,7 +101,7 @@ def test_run_cli_help():def test_model_replay_local_repo(swe_agent_test_repo_clone, swe_agent_test_repo_traj, problem_statement_source):local_repo_path = swe_agent_test_repo_cloneif problem_statement_source == "github":- problem_statement_path = "https://github.com/klieret/swe-agent-test-repo/issues/1"+ problem_statement_path = "https://github.com/swe-agent/test-repo/issues/1"elif problem_statement_source == "local":problem_statement_path = local_repo_path / "problem_statements" / "1.md"assert problem_statement_path.is_file()diff --git a/tests/test_run.py b/tests/test_run.pyindex 541968ac..c8f894ce 100644--- a/tests/test_run.py+++ b/tests/test_run.py@@ -31,7 +31,7 @@ def test_run_cli_help():def open_pr_hook_init_for_sop():hook = OpenPRHook()hook._token = os.environ.get("GITHUB_TOKEN", "")- hook._data_path = "https://github.com/klieret/swe-agent-test-repo/issues/1"+ hook._data_path = "https://github.com/swe-agent/test-repo/issues/1"hook._open_pr = Truehook._skip_if_commits_reference_issue = Truereturn hook@@ -65,31 +65,31 @@ def test_should_open_pr_fail_invalid_url(open_pr_hook_init_for_sop, info_dict):def test_should_open_pr_fail_closed(open_pr_hook_init_for_sop, info_dict):hook = open_pr_hook_init_for_sop- hook._data_path = "https://github.com/klieret/swe-agent-test-repo/issues/16"+ hook._data_path = "https://github.com/swe-agent/test-repo/issues/16"assert not hook.should_open_pr(info_dict)def test_should_open_pr_fail_assigned(open_pr_hook_init_for_sop, info_dict):hook = open_pr_hook_init_for_sop- hook._data_path = "https://github.com/klieret/swe-agent-test-repo/issues/17"+ hook._data_path = "https://github.com/swe-agent/test-repo/issues/17"assert not hook.should_open_pr(info_dict)def test_should_open_pr_fail_locked(open_pr_hook_init_for_sop, info_dict):hook = open_pr_hook_init_for_sop- hook._data_path = "https://github.com/klieret/swe-agent-test-repo/issues/18"+ hook._data_path = "https://github.com/swe-agent/test-repo/issues/18"assert not hook.should_open_pr(info_dict)def test_should_open_pr_fail_has_pr(open_pr_hook_init_for_sop, info_dict):hook = open_pr_hook_init_for_sop- hook._data_path = "https://github.com/klieret/swe-agent-test-repo/issues/19"+ hook._data_path = "https://github.com/swe-agent/test-repo/issues/19"assert not hook.should_open_pr(info_dict)def test_should_open_pr_success_has_pr_override(open_pr_hook_init_for_sop, info_dict):hook = open_pr_hook_init_for_sop- hook._data_path = "https://github.com/klieret/swe-agent-test-repo/issues/19"+ hook._data_path = "https://github.com/swe-agent/test-repo/issues/19"hook._skip_if_commits_reference_issue = Falseassert hook.should_open_pr(info_dict)@@ -106,7 +106,7 @@ def test_script_args():suffix="",environment=EnvironmentArguments(image_name="sweagent/swe-agent:latest",- data_path="https://github.com/klieret/swe-agent-test-repo/issues/1",+ data_path="https://github.com/swe-agent/test-repo/issues/1",split="dev",verbose=True,install_environment=True,