nvda.log
Structured log records, and assert_no_errors() for the common case of "my add-on shouldn’t
have logged anything alarming."
def test_the_installed_addon_logs_at_startup(nvda, addon_under_test):
nvda.restart_harness()
nvda.log.wait_for(re.escape(STARTUP_MESSAGE), since=0, timeout=20)
wait_for(pattern, *, timeout=10.0, since=None, flags=re.IGNORECASE) searches record messages
with re.search. With since=None it snapshots index() at call time and only sees records
logged afterwards; pass since=0 (as above) to search the whole session, or an index() taken
earlier to ignore anything logged before that point.
index(), since(index), all() and clear() mirror nvda.speech.
errors() and warnings() filter by level (warnings() includes errors); assert_no_errors()
and assert_no_warnings() raise AssertionError with the offending records attached. All four
take since=0 to limit the search.