diff options
author | Georg Brandl <georg@python.org> | 2020-02-29 15:45:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-29 15:45:08 +0100 |
commit | 35544e2fc6eed0ce4a27ec7285aac71ff0ddc473 (patch) | |
tree | 4390507bf0d4d5a4596cfc57c575da12f9da40f9 /tests/test_cmdline.py | |
parent | 14fc057d300102d88a07eda5558f238d49dd23f6 (diff) | |
download | pygments-git-35544e2fc6eed0ce4a27ec7285aac71ff0ddc473.tar.gz |
Remove Python 2 compatibility (#1348)
* Remove Python 2 compatibility
* remove 2/3 shims in pygments.util
* update setup.py metadata
* Remove unneeded object inheritance.
* Remove unneeded future imports.
Diffstat (limited to 'tests/test_cmdline.py')
-rw-r--r-- | tests/test_cmdline.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index d56e2ae5..b9b07c3c 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -7,19 +7,17 @@ :license: BSD, see LICENSE for details. """ -from __future__ import print_function - import io import os import re import sys import tempfile +from io import BytesIO from os import path from pytest import raises from pygments import cmdline, highlight -from pygments.util import BytesIO, StringIO TESTDIR = path.dirname(path.abspath(__file__)) TESTFILE = path.join(TESTDIR, 'test_cmdline.py') @@ -41,17 +39,12 @@ def run_cmdline(*args, **kwds): saved_stdin = sys.stdin saved_stdout = sys.stdout saved_stderr = sys.stderr - if sys.version_info > (3,): - stdin_buffer = BytesIO() - stdout_buffer = BytesIO() - stderr_buffer = BytesIO() - new_stdin = sys.stdin = io.TextIOWrapper(stdin_buffer, 'utf-8') - new_stdout = sys.stdout = io.TextIOWrapper(stdout_buffer, 'utf-8') - new_stderr = sys.stderr = io.TextIOWrapper(stderr_buffer, 'utf-8') - else: - stdin_buffer = new_stdin = sys.stdin = StringIO() - stdout_buffer = new_stdout = sys.stdout = StringIO() - stderr_buffer = new_stderr = sys.stderr = StringIO() + stdin_buffer = BytesIO() + stdout_buffer = BytesIO() + stderr_buffer = BytesIO() + new_stdin = sys.stdin = io.TextIOWrapper(stdin_buffer, 'utf-8') + new_stdout = sys.stdout = io.TextIOWrapper(stdout_buffer, 'utf-8') + new_stderr = sys.stderr = io.TextIOWrapper(stderr_buffer, 'utf-8') new_stdin.write(kwds.get('stdin', '')) new_stdin.seek(0, 0) try: |