Files
hermes-agent/tests/tools/test_tts_output_timestamp.py
teknium1 4ebda1dddb test: restore tools regression guards dropped by #120071
- test_code_kernel::TestModelFacingReset: reset stays in the schema under a stale
  kernel_mode and a model-shaped reset call really discards kernel state (#96787).
- test_computer_use::TestStartupTimeoutPhaseDetail: cua-driver ready timeout names
  the wedged phase + doctor hint, and the session stays un-started (#57025/#69372).
- test_file_operations::TestEscapeNativeToolArg (windows_only, was FAKE_OS): rg
  search and the node --check linter get native C:/ paths, not /c/ (#84303).
- test_file_tools::TestSSHConfigWriteGate (2): a ~/.ssh/config write goes through
  the real approval gate, BLOCKED with nobody present / in -q mode, nothing written (#93201).
- test_lazy_deps: a newer compatible plugin SDK is satisfied, never re-pinned down
  (#98407, #86992); windows_only real Matrix probe reports unsupported.
- test_mcp_empty_error_message: empty/whitespace exception messages still yield a
  diagnostic (#19417).
- test_mcp_stdio_children_dead: the fast-fail probe never calls the watcher on the
  plain path, no un-awaited coroutine (#96044).
- test_subprocess_utf8_encoding: real _op_whoami survives invalid UTF-8 child output (#53428/#55339).
- test_tts_output_timestamp: same-second TTS calls get distinct output files (#43911).
- test_windows_agent_loop_papercuts::TestAutocompleteDevicePaths: a relpath
  ValueError on a device path is skipped, not raised (#42016).
- test_windows_native_support::TestCronSchedulerBashResolution (2): cron .sh uses
  bash from PATH; missing bash is an actionable error, not WinError 2.
2026-09-23 10:34:54 -07:00

34 lines
1.2 KiB
Python

"""Regression test for salvaged PR #43911 — microsecond TTS output timestamps.
Default output paths used second-resolution ``%Y%m%d_%H%M%S`` timestamps, so
two text_to_speech_tool calls landing in the same wall-clock second produced
the same filename and the second synthesis overwrote the first.
"""
import datetime as real_datetime
from types import SimpleNamespace
from tools import tts_tool
def test_default_output_paths_differ_within_the_same_second(tmp_path, monkeypatch):
stamps = iter([
real_datetime.datetime(2026, 9, 23, 12, 0, 0, 1000),
real_datetime.datetime(2026, 9, 23, 12, 0, 0, 2000),
])
class _FrozenDateTime:
@staticmethod
def now():
return next(stamps)
monkeypatch.setattr(tts_tool, "datetime", SimpleNamespace(datetime=_FrozenDateTime))
monkeypatch.setattr(tts_tool, "_default_output_dir", lambda: str(tmp_path))
first, err1 = tts_tool._resolve_output_base(None, "edge", None, False)
second, err2 = tts_tool._resolve_output_base(None, "edge", None, False)
assert err1 is None and err2 is None
assert first.parent == tmp_path and second.parent == tmp_path
assert first != second, "same-second TTS calls must not share an output file (#43911)"