fix: patch _REDACT_ENABLED in test fixture for module-level snapshot
The _REDACT_ENABLED constant is snapshotted at import time, so monkeypatch.delenv() alone doesn't re-enable redaction during tests when HERMES_REDACT_SECRETS=false is set in the host environment.
This commit is contained in:
@@ -12,6 +12,8 @@ from agent.redact import redact_sensitive_text, RedactingFormatter
|
||||
def _ensure_redaction_enabled(monkeypatch):
|
||||
"""Ensure HERMES_REDACT_SECRETS is not disabled by prior test imports."""
|
||||
monkeypatch.delenv("HERMES_REDACT_SECRETS", raising=False)
|
||||
# Also patch the module-level snapshot so it reflects the cleared env var
|
||||
monkeypatch.setattr("agent.redact._REDACT_ENABLED", True)
|
||||
|
||||
|
||||
class TestKnownPrefixes:
|
||||
|
||||
Reference in New Issue
Block a user