From 4a4a3bdd3676a2145a092e8d6997d62f2f8e9c51 Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 11 Nov 2026 06:13:20 -0700 Subject: [PATCH] Report receiver: keep its log out of the test output The receiver logs each report it files in Gitea, or fails to, from a background thread. Those lines landed in the middle of the test results. Capture stderr in each test instead, in self.stderr for tests that want to check it. Co-Authored-By: Claude Opus 5.5 --- server/report-receiver/test_receiver.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/report-receiver/test_receiver.py b/server/report-receiver/test_receiver.py index bb67c56..328e0e6 100644 --- a/server/report-receiver/test_receiver.py +++ b/server/report-receiver/test_receiver.py @@ -3,8 +3,10 @@ They start the receiver on a free port with a fake Gitea, and send it reports with the real `report` client, the way a CoreDesktop machine would.""" +import contextlib import gzip import http.server +import io import json import os import shutil @@ -66,6 +68,10 @@ class FakeGitea: class ReceiverTest(unittest.TestCase): def setUp(self): + # Keep what the receiver logs ("filed as issue #1", ...) out of the + # test results. It's in self.stderr for a test that wants to check it. + self.stderr = io.StringIO() + self.enterContext(contextlib.redirect_stderr(self.stderr)) self.tmp = Path(tempfile.mkdtemp()) self.gitea = FakeGitea() self.store = receiver.Store(self.tmp / "state", receiver.Gitea(self.gitea.url, "Federated_Computer/coredesktop-reports", "secret"))