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

output not being redirected by contextlib #101

Open
roedoejet opened this issue Dec 18, 2020 · 0 comments
Open

output not being redirected by contextlib #101

roedoejet opened this issue Dec 18, 2020 · 0 comments

Comments

@roedoejet
Copy link

When testing log outputs I sometimes use io and contextlib.redirect_stderr in the following way:

import io
from contextlib import redirect_stderr

log_output = io.StringIO()
with redirect_stderr(log_output):
    cause_some_horrible_error()

Up until 14.1, this would work as expected. That is, running log_output.getvalue() would return the output of the logged error. However, now log_output.getvalue() just returns an empty string. This seems broken in 14.1, 14.2, 14.3 and 15.0.

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

No branches or pull requests

1 participant