Keep speech regression gate current with shared voice profiles

This commit is contained in:
Storm Dragon committed 2026-11-16 23:31:31 -05:00
1 parent 5fd5a26120
commit 758b038e1a
3 files changed
+81 -5

No files matched your search

+18 -3
View File
@@ -26,6 +26,16 @@ requiredTests = {
"TestEchoSpeakerSwitchesBothVoicesTransactionally",
"TestSpeechWorkerKeyEchoCompletesBeforeCaretSpeech",
"TestSpeechWorkerKeyEchoWaitStillAllowsInputInterruption",
"TestQuickVoiceProfilesFailurePersistenceAndApplicationInheritance",
"TestQuickVoiceProfileDefaultRestoresSavedVoiceFromCustom",
"TestQuickVoiceProfileDefaultIsFocusedApplicationVoice",
"TestAppliedNewVoiceProfileIsImmediatelyAvailableAcrossApplications",
"TestProfileVoicePreviewReachesBackendWithoutCommitting",
"TestPreferencesVoicePreviewDoesNotCommitAndCancelRestores",
"TestPreferencesSessionRestoresPreviewAfterRejectedApplyAndReopen",
"TestVoiceProfilesPersistencePrimaryScopeAndApplicationSave",
"TestClosedGTKComboSelectionSpeaksOnlyNewValue",
"TestComboHistoryKeepsFocusedValueAcrossOtherComboUpdates",
}
@@ -37,13 +47,18 @@ def run_checks(sourceRoot: Path) -> None:
del testEnv[name]
testEnv.pop("DISPLAY", None)
testEnv.pop("WAYLAND_DISPLAY", None)
# A pushed snapshot must use its pinned dependency, even when the caller
# develops against a sibling screenreader-common workspace.
testEnv["GOWORK"] = "off"
testEnv["CTHULHU_WINE_TITLE_DBUS"] = "1"
testPattern = ("^Test.*(Title|Repeat|Interrupt|Echo)|^Test(SpeechWorker|Cancel|WineReview)|"
"^(" + "|".join(sorted(requiredTests)) + ")$")
command = [
"dbus-run-session", "--", "go", "test", "-json", "-race", "-count=1",
"-timeout=60s", "-run", "^Test.*(Title|Repeat|Interrupt|Echo)|^Test(SpeechWorker|Cancel|WineReview)",
"./internal/app", "./internal/input", "./internal/presentation", "./internal/speech", "./internal/wine",
"-timeout=60s", "-run", testPattern,
"./internal/app", "./internal/config", "./internal/input", "./internal/presentation", "./internal/speech", "./internal/wine",
]
print("Checking speech queues, key echo, Wine metadata and key interruption...", flush=True)
print("Checking speech queues, key echo, voice profiles, previews, combo feedback and key interruption...", flush=True)
result = run_private_session(command, cwd=sourceRoot, env=testEnv, text=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False)
passedTests = set()
+58
View File
@@ -0,0 +1,58 @@
# Copyright (c) 2026 Storm Dragon
# SPDX-License-Identifier: GPL-3.0-or-later
"""Check required regression selection and failure handling without live speech."""
import contextlib
import io
import json
from pathlib import Path
import re
import subprocess
import unittest
from unittest.mock import patch
import check_speech
class SpeechCheckTests(unittest.TestCase):
def run_check(self, events, returnCode=0):
result = subprocess.CompletedProcess([], returnCode, "\n".join(
json.dumps(event) for event in events))
with patch("check_speech.run_private_session", return_value=result) as run, \
contextlib.redirect_stdout(io.StringIO()), \
contextlib.redirect_stderr(io.StringIO()):
check_speech.run_checks(Path("/private/source"))
return run.call_args
def passing_events(self):
return [{"Action": "pass", "Test": name} for name in check_speech.requiredTests]
def test_selects_required_tests_from_standalone_snapshot(self):
with patch.dict("os.environ", {"GOWORK": "/private/go.work",
"GIT_DIR": "/private/other/.git"}):
call = self.run_check(self.passing_events())
command = call.args[0]
pattern = command[command.index("-run") + 1]
for name in check_speech.requiredTests:
self.assertIsNotNone(re.search(pattern, name), name)
self.assertIn("./internal/config", command)
self.assertEqual(call.kwargs["env"]["GOWORK"], "off")
self.assertNotIn("GIT_DIR", call.kwargs["env"])
self.assertEqual(call.kwargs["cwd"], Path("/private/source"))
def test_missing_required_test_fails(self):
with self.assertRaisesRegex(RuntimeError, "speech regression check failed"):
self.run_check(self.passing_events()[1:])
def test_skipped_required_test_fails(self):
events = self.passing_events()
events[0]["Action"] = "skip"
with self.assertRaisesRegex(RuntimeError, "speech regression check failed"):
self.run_check(events)
def test_process_failure_fails_even_when_required_tests_pass(self):
with self.assertRaisesRegex(RuntimeError, "speech regression check failed"):
self.run_check(self.passing_events(), returnCode=1)
if __name__ == "__main__":
unittest.main()