summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_optparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_optparse.py')
-rw-r--r--Lib/test/test_optparse.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index 2bae0a6..1cfdd50 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -14,7 +14,7 @@ import re
import copy
import unittest
-from StringIO import StringIO
+from io import StringIO
from pprint import pprint
from test import test_support
@@ -157,12 +157,9 @@ and kwargs %(kwargs)r
expected_error=None):
"""Assert the parser prints the expected output on stdout."""
save_stdout = sys.stdout
- encoding = getattr(save_stdout, 'encoding', None)
try:
try:
sys.stdout = StringIO()
- if encoding:
- sys.stdout.encoding = encoding
self.parser.parse_args(cmdline_args)
finally:
output = sys.stdout.getvalue()