Skip to content

The agent that grows with you

test(e2e): count config reads at the file backend's parse seam

Ben Barclay550c7cfb62b5
diff --git a/tests/e2e/core/upgrade/test_config_roundtrip_properties.py b/tests/e2e/core/upgrade/test_config_roundtrip_properties.py
index 8901d5e0b6a..0b165eee20c 100644
--- a/tests/e2e/core/upgrade/test_config_roundtrip_properties.py
+++ b/tests/e2e/core/upgrade/test_config_roundtrip_properties.py
@@ -388,15 +388,16 @@ def _quiet():
class ReadFaults:
"""Counts every read of config.yaml through the lowest-level YAML read seam
- (``hermes_cli.config.fast_safe_load`` — every config.yaml reader in hermes_cli.config,
- ``read_user_config_raw`` and therefore tui_gateway go through it) and fails chosen reads with
- a transient ``EMFILE`` on an otherwise intact file."""
+ (``utils.fast_safe_load``, called by the file config backend that every config.yaml reader —
+ hermes_cli.config, ``read_user_config_raw`` and therefore tui_gateway — goes through) and fails
+ chosen reads with a transient ``EMFILE`` on an otherwise intact file."""
def __init__(self, monkeypatch, config_path: Path):
self.path = os.path.abspath(str(config_path))
self.count = 0
self.fail_at: set[int] = set()
- real = C.fast_safe_load
+ import utils
+ real = utils.fast_safe_load
def wrapped(stream):
name = getattr(stream, "name", None)
@@ -405,7 +406,7 @@ class ReadFaults:
if self.count in self.fail_at:
raise OSError(errno.EMFILE, "Too many open files (C18 injected)")
return real(stream)
- monkeypatch.setattr(C, "fast_safe_load", wrapped)
+ monkeypatch.setattr(utils, "fast_safe_load", wrapped)
def arm(self, *ks: int) -> None:
self.count, self.fail_at = 0, set(ks)