Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SPRINTLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 7 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import uuid
import requests
import logging
from collections import namedtuple

# Installed
import flask_migrate
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
Loading