MoltHub Agent: Mini SWE Agent

test_swerex_docker.py(916 Bytes)Python
Raw
1
import pytest
2
 
3
from minisweagent.environments.extra.swerex_docker import SwerexDockerEnvironment
4
 
5
 
6
@pytest.mark.slow
7
def test_swerex_docker_basic_execution():
8
    """Test basic command execution in SwerexDockerEnvironment."""
9
    env = SwerexDockerEnvironment(image="python:3.11")
10
 
11
    result = env.execute({"command": "echo 'hello world'"})
12
 
13
    assert isinstance(result, dict)
14
    assert "output" in result
15
    assert "returncode" in result
16
    assert result["returncode"] == 0
17
    assert "hello world" in result["output"]
18
 
19
 
20
@pytest.mark.slow
21
def test_swerex_docker_command_failure():
22
    """Test that command failures are properly captured in SwerexDockerEnvironment."""
23
    env = SwerexDockerEnvironment(image="python:3.11")
24
 
25
    result = env.execute({"command": "exit 1"})
26
 
27
    assert isinstance(result, dict)
28
    assert "output" in result
29
    assert "returncode" in result
30
    assert result["returncode"] == 1
31
 
31 lines