Skip to content

The agent that grows with you

test: one invariant for the importable-resource stub, drop the change-detector

teknium10ff9941b762c
diff --git a/tests/hermes_cli/test_resource_limits.py b/tests/hermes_cli/test_resource_limits.py
index a4dd998cf4d..22018f30a74 100644
--- a/tests/hermes_cli/test_resource_limits.py
+++ b/tests/hermes_cli/test_resource_limits.py
@@ -100,13 +100,6 @@ def test_unsupported_platform_is_a_safe_noop(monkeypatch):
assert resource_limits.apply_nofile_soft_limit({}) is False
-def test_windows_resource_stub_without_rlimit_attributes_is_a_safe_noop(monkeypatch):
- """Windows can import ``resource`` even when its POSIX API is absent."""
- monkeypatch.setattr(resource_limits, "_resource", object())
-
- assert resource_limits.apply_nofile_soft_limit({}) is False
-
-
def test_fresh_process_import_without_posix_resource_is_a_safe_noop():
code = textwrap.dedent(
"""
diff --git a/tests/hermes_state/test_session_db_read_conn_pool.py b/tests/hermes_state/test_session_db_read_conn_pool.py
index 3d8f0352b43..0cafe6b62e2 100644
--- a/tests/hermes_state/test_session_db_read_conn_pool.py
+++ b/tests/hermes_state/test_session_db_read_conn_pool.py
@@ -627,14 +627,16 @@ def test_fd_headroom_guard_fails_open_where_it_cannot_measure(monkeypatch):
assert readpool._fd_headroom_ok() is False
-def test_fd_soft_limit_ignores_windows_resource_stub(monkeypatch):
- """A Windows resource stub has no POSIX RLIMIT attributes."""
+def test_fd_soft_limit_fails_open_for_importable_resource_stub(monkeypatch):
+ """An importable ``resource`` without ``getrlimit`` (third-party Windows stub,
+ #111877) must read as "unmeasurable", not abort every session read."""
import sys
- from types import SimpleNamespace
+ import types
- monkeypatch.setitem(sys.modules, "resource", SimpleNamespace())
+ monkeypatch.setitem(sys.modules, "resource", types.ModuleType("resource"))
assert hermes_state_readpool._fd_soft_limit() is None
+ assert hermes_state_readpool._fd_headroom_ok() is True
@pytest.mark.requires_wal