8000 [3.7] bpo-34421: Improve distutils logging for non-ASCII strings. (GH-9126) by serhiy-storchaka · Pull Request #9506 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.7] bpo-34421: Improve distutils logging for non-ASCII strings. (GH-9126) #9506

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

Merged
merged 2 commits into from
Sep 23, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Use in-memory stream instead of NamedTemporaryFile.
  • Loading branch information
serhiy-storchaka committed Sep 23, 2018
commit 8a961226e1f1ff60218965bab832b176bf72e88f
10 changes: 6 additions & 4 deletions Lib/distutils/tests/test_log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Tests for distutils.log"""

import io
import sys
import unittest
from tempfile import NamedTemporaryFile
from test.support import swap_attr, run_unittest

from distutils import log
Expand All @@ -14,9 +14,11 @@ def test_non_ascii(self):
# output as is.
for errors in ('strict', 'backslashreplace', 'surrogateescape',
'replace', 'ignore'):
with self.subTest(errors=errors), \
NamedTemporaryFile("w+", encoding='cp437', errors=errors) as stdout, \
NamedTemporaryFile("w+", encoding='cp437', errors=errors) as stderr:
with self.subTest(errors=errors):
stdout = io.TextIOWrapper(io.BytesIO(),
encoding='cp437', errors=errors)
stderr = io.TextIOWrapper(io.BytesIO(),
encoding='cp437', errors=errors)
old_threshold = log.set_threshold(log.DEBUG)
try:
with swap_attr(sys, 'stdout', stdout), \
Expand Down
0