Skip to content

Commit c8ff4d8

Browse files
authored
Merge pull request #175 from reacher-z/ci/run-tests
ci: run tests
2 parents 5ba7936 + 72c11fc commit c8ff4d8

4 files changed

Lines changed: 59 additions & 5 deletions

File tree

.github/workflows/run-test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: run-test
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- ".github/workflows/run-test.yml"
8+
- "src/clawbench/**"
9+
- "tests/**"
10+
- "pyproject.toml"
11+
- "uv.lock"
12+
push:
13+
branches: [ main ]
14+
paths:
15+
- ".github/workflows/run-test.yml"
16+
- "src/clawbench/**"
17+
- "tests/**"
18+
- "pyproject.toml"
19+
- "uv.lock"
20+
workflow_dispatch:
21+
22+
jobs:
23+
run-test:
24+
name: pytest (${{ matrix.os }})
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os:
30+
- ubuntu-latest
31+
- macos-latest
32+
- windows-latest
33+
34+
steps:
35+
- uses: actions/checkout@v6
36+
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v8.1.0
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v6
42+
with:
43+
python-version: "3.11"
44+
45+
- name: Run host-side pytest suite
46+
run: uv run --frozen pytest

tests/test_cli_entrypoints.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import subprocess
66
import sys
77
import textwrap
8+
import os
89
from pathlib import Path
910

1011
import pytest
@@ -40,10 +41,13 @@ def test_module_help_does_not_require_container_runtime(module: str) -> None:
4041
runpy.run_module(module, run_name="__main__")
4142
"""
4243
)
44+
env = os.environ.copy()
45+
env["PYTHONPATH"] = str(SRC_ROOT)
46+
4347
result = subprocess.run(
4448
[sys.executable, "-c", code, module],
4549
capture_output=True,
46-
env={"PYTHONPATH": str(SRC_ROOT)},
50+
env=env,
4751
text=True,
4852
timeout=30,
4953
)

tests/test_host_resources.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ def test_prepare_personal_info_writes_container_mount_resources(tmp_path: Path)
2222
tmp_path,
2323
)
2424

25-
personal_info = json.loads((info_dir / "alex_green_personal_info.json").read_text())
26-
email_credentials = json.loads((info_dir / "email_credentials.json").read_text())
25+
personal_info = json.loads(
26+
(info_dir / "alex_green_personal_info.json").read_text(encoding="utf-8")
27+
)
28+
email_credentials = json.loads(
29+
(info_dir / "email_credentials.json").read_text(encoding="utf-8")
30+
)
2731

2832
assert personal_info["contact"]["email"] == "alex@example.test"
2933
assert "online_accounts" not in personal_info
@@ -40,7 +44,7 @@ def test_prepare_personal_info_writes_container_mount_resources(tmp_path: Path)
4044

4145
def test_extra_info_copy_and_instruction_are_host_side(tmp_path: Path) -> None:
4246
task_dir = ASSET_ROOT / "test-cases" / "v1" / "007-daily-life-food-instacart"
43-
task = json.loads((task_dir / "task.json").read_text())
47+
task = json.loads((task_dir / "task.json").read_bytes())
4448
my_info = tmp_path / "my-info"
4549
my_info.mkdir()
4650

tests/test_host_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_checked_task_json_files_parse_and_validate(suite: str) -> None:
4949

5050
assert task_files, f"{suite} should expose readable task JSON files"
5151
for task_file in task_files:
52-
task = json.loads(task_file.read_text())
52+
task = json.loads(task_file.read_bytes())
5353
validated = validate_task_data(task, task_file)
5454
assert validated is task
5555

0 commit comments

Comments
 (0)