Repository navigation
Make the test capfd wrapper return out/err like pytest’s CaptureResult - #1882
Conversation
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.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1882 +/- ##
=======================================
Coverage 92.94% 92.94%
=======================================
Files 30 30
Lines 5074 5074
=======================================
Hits 4716 4716
Misses 358 358 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SevLG
left a comment
There was a problem hiding this comment.
Looks good,
As mentioned in the PR description, https://docs.pytest.org/en/stable/reference/reference.html says that the CaptureFixture object returned by capfd:
- Returns the captured content as a namedtuple with out and err string attributes,
- Has return type: CaptureResult.
This change thus gives the custom capfd the correct return type.
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.
Pull Request Template
Before Marking as Ready for Review
dev(or other targeted branch)SPRINTLOG.mdif neededIf the target branch is
master:Summary
Make the custom test capfd wrapper return a CaptureResult-shaped object (out / err) instead of a plain (out, err) tuple.
The wrapper still appends captured general logger lines to stderr for existing assertions, and still supports tuple unpacking. Uses a local namedtuple so we don’t depend on private _pytest.capture.
Test-only change in tests/conftest.py (+ SPRINTLOG). No app/runtime impact.
Related Issue/Ticket
HMS-2651
Testing
Existing tests that use _, err = capfd.readouterr() keep working
Attribute access capfd.readouterr().err / .out works
CI pytest
Reviewer Notes
Anything that helps reviewers (e.g. areas needing close attention).
Once all boxes are checked, mark the PR as Ready for Review and tag at least one team member as the initial reviewer.