"""Tests for shell_run skill."""

from skill import run


def test_echo():
    result = run("echo hello")
    assert result["returncode"] == 0
    assert result["stdout"].strip() == "hello"
    assert result["command"] == "echo hello"


def test_failing_command():
    result = run("false")
    assert result["returncode"] != 0


def test_timeout():
    import pytest

    with pytest.raises(subprocess.TimeoutExpired):
        run("sleep 10", timeout=1)


import subprocess
