Merge remote-tracking branch 'origin/main' into item-530
CI / tests (pull_request) Has been cancelled

This commit is contained in:
2026-11-24 00:10:15 +01:00
8 changed files with 42 additions and 18 deletions
+28
View File
@@ -0,0 +1,28 @@
import pathlib
import re
import sys
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from run_tests.main import PYTEST
from repo_checks import ROOT
DOCKERFILE = (ROOT / "task-bench-image" / "Dockerfile").read_text(encoding="utf-8")
class TaskBenchImage(unittest.TestCase):
def test_the_image_has_the_python_tag_that_ci_sh_runs(self):
images = re.findall(r"^FROM (python:\S+)$", DOCKERFILE, re.MULTILINE)
self.assertEqual(len(images), 1, "task-bench-image/Dockerfile starts from one python image")
# ci.sh prints its Dockerfile with printf, so the line ends in a backslash and an n.
self.assertIn(f"FROM {images[0]}\\n", (ROOT / "ci.sh").read_text(encoding="utf-8"))
def test_the_image_installs_the_pytest_pins_that_run_tests_uses(self):
installed = set(re.findall(r"\b(pytest(?:-xdist)?==[\d.]+)", DOCKERFILE))
pins = {word for word in PYTEST if re.fullmatch(r"pytest(?:-xdist)?==[\d.]+", word)}
self.assertEqual(installed, pins)
def test_each_pytest_pin_in_the_readme_is_the_one_run_tests_uses(self):
pinned = {word for word in PYTEST if re.fullmatch(r"pytest==[\d.]+", word)}
self.assertEqual(set(re.findall(r"\bpytest==[\d.]+", (ROOT / "README.md").read_text(encoding="utf-8"))), pinned)
+1 -1
View File
@@ -22,7 +22,7 @@ import typing
from machine_load.slots import CPUS_PER_SLOT
BIN = pathlib.Path(__file__).resolve().parents[1]
# ci.sh runs this command, so its pins live here; README.md → Test's mutation command repeats the pytest pin, so change both. The workers fill one heavy slot, since run-heavy grants one.
# ci.sh runs this command, so its pins live here; README.md → Test's mutation and bench commands and task-bench-image/Dockerfile repeat the pytest pins, and bin/repo_checks/test_task_bench_image.py fails where one differs. The workers fill one heavy slot, since run-heavy grants one.
PYTEST = ["uvx", "--python", shutil.which("python3") or sys.executable, "--with", "pytest-xdist==3.8.0", "pytest==9.2.0", "-n", str(CPUS_PER_SLOT)]
SECTION = re.compile(r"^=+ (.+) =+$")
TEST_HEADER = re.compile(r"^_+ .+ _+$")