Report receiver: keep its log out of the test output
shellcheck / shellcheck (push) Failing after 17s
shellcheck / shellcheck (push) Failing after 17s
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user