From 0bda19c2d5421b8aab8b14b45dacb816fd2fc34d Mon Sep 17 00:00:00 2001 From: azfoo <45888544+azfoo@users.noreply.github.com> Date: Thu, 23 Jul 2026 14:11:16 +0200 Subject: [PATCH 1/2] fix[test]: flaky sentry call use_test_logger here to make it non-order dependent. we previously relied on it to have been called first by some other test that used qtui. --- tests/test_app.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index 2e96f8301..b915bc87d 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -32,9 +32,7 @@ class TestLogger: - def test_sentry_not_logging(self): - # TODO: make this test run first in batch testing. - # enabling sentry during tests will fill inbox up unnecessarily + def test_sentry_not_logging(self, use_test_logger): assert "tilia.log" in tilia.log.sentry_sdk.integrations.logging._IGNORED_LOGGERS From 6adb1a097ab604e3b0bf09f67835d5c87023f92c Mon Sep 17 00:00:00 2001 From: azfoo <45888544+azfoo@users.noreply.github.com> Date: Thu, 23 Jul 2026 14:16:07 +0200 Subject: [PATCH 2/2] test: sentry - ignore_logger prevents sentry logs from occuring - sentry never receives errors from tests --- tests/test_app.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_app.py b/tests/test_app.py index b915bc87d..4901ba2f4 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -1,4 +1,5 @@ import json +import logging from pathlib import Path from typing import Literal from unittest.mock import patch @@ -35,6 +36,28 @@ class TestLogger: def test_sentry_not_logging(self, use_test_logger): assert "tilia.log" in tilia.log.sentry_sdk.integrations.logging._IGNORED_LOGGERS + def test_sentry_ignores_tilia_log_records(self): + tilia.log.sentry_sdk.integrations.logging.ignore_logger(tilia.log.logger.name) + record = logging.LogRecord( + name=tilia.log.logger.name, + level=logging.CRITICAL, + pathname=__file__, + lineno=0, + msg="intentional test failure - must not reach Sentry", + args=None, + exc_info=None, + ) + event_handler = tilia.log.sentry_sdk.integrations.logging.EventHandler() + breadcrumb_handler = ( + tilia.log.sentry_sdk.integrations.logging.BreadcrumbHandler() + ) + assert not event_handler._can_record(record) + assert not breadcrumb_handler._can_record(record) + + def test_sentry_is_never_initialized_during_tests(self): + client = tilia.log.sentry_sdk.get_client() + assert not client.is_active() + class TestSaveFileOnClose: @staticmethod