From d4fa28d4d8d6d43aaf0cca47cd93a4e44f21299b Mon Sep 17 00:00:00 2001 From: Valentin Georgiev Date: Thu, 22 Oct 2026 11:02:00 +0200 Subject: [PATCH 1/2] Return a CaptureResult-shaped tuple from the test capfd wrapper The custom capfd fixture returned a plain (out, err) tuple, so tests using capfd.readouterr().err would fail with AttributeError. Return a namedtuple with out/err fields instead, matching pytest's CaptureResult while still supporting tuple unpacking. A local namedtuple avoids importing the private _pytest.capture module. --- tests/conftest.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2aadd841a..5cbcb2a10 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,6 +6,7 @@ import uuid import requests import logging +from collections import namedtuple # Installed import flask_migrate @@ -573,6 +574,11 @@ def disable_requests_cache(): yield +# Same shape as pytest's CaptureResult (out/err + unpacking), without importing +# private _pytest modules that can move between pytest releases. +_CaptureResult = namedtuple("CaptureResult", "out err") + + @pytest.fixture def capfd(capfdbinary): """Capture fd output and include newly emitted log records in stderr text. @@ -618,7 +624,7 @@ def readouterr(self): log_text = "\n".join(new_logs) err = f"{err}\n{log_text}" if err else log_text - return out, err + return _CaptureResult(out, err) def __getattr__(self, name): return getattr(capfdbinary, name) From 11bb4c73dd9cf5575724460a8e7d4f5b28bc77f6 Mon Sep 17 00:00:00 2001 From: Valentin Georgiev Date: Thu, 22 Oct 2026 11:29:38 +0200 Subject: [PATCH 2/2] sprintlog --- SPRINTLOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 0da2c7276..4adeeda1a 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -694,3 +694,4 @@ _Nothing merged during this sprint_ - Update dependency urllib3 to v2.8.0 [SECURITY] ([#1875]https://github.com/ScilifelabDataCentre/dds_web/pull/1875) - Update dependency Werkzeug to v3.1.9 [SECURITY] ([#1877]https://github.com/ScilifelabDataCentre/dds_web/pull/1877) - Bump GitHub Actions used in CI workflows ([#1881]https://github.com/ScilifelabDataCentre/dds_web/pull/1881) +- Make the test capfd wrapper return out/err like pytest’s CaptureResult ([#1882]https://github.com/ScilifelabDataCentre/dds_web/pull/1882)