Import AITURK IDE 1.0.0-beta.1 from Hermes 63279301; preserve MIT license

This commit is contained in:
2026-09-05 13:26:46 +03:00
commit 03634b1ca3
11340 changed files with 3442369 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
"""Tests for the systemd ExecStopPost cgroup reaper (issue #37454)."""
from __future__ import annotations
import os
import signal
from pathlib import Path
import pytest
from gateway import cgroup_cleanup
class TestOwnCgroupPath:
def test_parses_v2_cgroup_path(self, tmp_path, monkeypatch):
proc_self = tmp_path / "cgroup"
proc_self.write_text("0::/user.slice/user-1000.slice/hermes-gateway.service\n")
monkeypatch.setattr(
cgroup_cleanup,
"Path",
lambda p: proc_self if p == "/proc/self/cgroup" else Path(p),
)
assert cgroup_cleanup._own_cgroup_path() == "/user.slice/user-1000.slice/hermes-gateway.service"
class TestReapCgroup:
def test_noop_when_procs_file_missing(self, tmp_path, monkeypatch):
cgroup_path = "/missing.slice/hermes-gateway.service"
monkeypatch.setattr(
cgroup_cleanup,
"Path",
lambda p: tmp_path / "does-not-exist" if "cgroup.procs" in p else Path(p),
)
def _explode(*_a, **_kw):
pytest.fail("os.kill must not be called when cgroup.procs is unreadable")
monkeypatch.setattr(cgroup_cleanup.os, "kill", _explode)
assert cgroup_cleanup.reap_cgroup(cgroup_path) == 0