Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

progress: tweak how os.Stderr is mocked #818

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Feb 4, 2025

This commit changes the way os.Stderr is mocked so that higher level consumes of the libary can use helpers can replace os.Stderr (like testutil.CaptureStdio() is doing). The existing approach assigns the "real" os.Stderr to osStderr so early that it cannot be changed later.

This will allow the test outlined in osbuild/image-builder-cli#124

@mvo5 mvo5 requested a review from ondrejbudai February 4, 2025 11:21
Copy link
Member

@ondrejbudai ondrejbudai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@ondrejbudai ondrejbudai enabled auto-merge February 4, 2025 12:23
This commit changes the way `os.Stderr` is mocked so that higher
level consumes of the libary can use helpers can replace os.Stderr
(like `testutil.CaptureStdio()` is doing). The existing approach
assigns the "real" os.Stderr to osStderr so early that it cannot
be changed later.
@mvo5 mvo5 force-pushed the progress-use-osStderr branch from d7b567e to 8d088db Compare February 5, 2025 16:36
@ondrejbudai ondrejbudai added this pull request to the merge queue Feb 5, 2025
auto-merge was automatically disabled February 5, 2025 18:50

Pull Request is not mergeable

Merged via the queue into osbuild:main with commit b35eaa8 Feb 5, 2025
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants