diff options
author | David Lord <davidism@gmail.com> | 2020-04-19 22:16:48 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-04-20 07:12:52 -0700 |
commit | 62f84aa3242d6d9f57243b941b013b2536ea3b9c (patch) | |
tree | 66ce32c33fd03caebd121272650eece5e68f2b3c /tests/test_utils.py | |
parent | 00883dd3d0a29f68f375cab5e21cef0669941aba (diff) | |
download | click-62f84aa3242d6d9f57243b941b013b2536ea3b9c.tar.gz |
remove more compat code
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r-- | tests/test_utils.py | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index d86f59b..2ca1a8a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,6 +1,7 @@ import os import stat import sys +from io import StringIO import pytest @@ -19,19 +20,7 @@ def test_echo(runner): bytes = outstreams[0].getvalue().replace(b"\r\n", b"\n") assert bytes == b"\xe2\x98\x83\nDD\n42ax" - # If we are in Python 2, we expect that writing bytes into a string io - # does not do anything crazy. In Python 3 - if sys.version_info[0] == 2: - import StringIO - - sys.stdout = x = StringIO.StringIO() - try: - click.echo("\xf6") - finally: - sys.stdout = sys.__stdout__ - assert x.getvalue() == "\xf6\n" - - # And in any case, if wrapped, we expect bytes to survive. + # if wrapped, we expect bytes to survive. @click.command() def cli(): click.echo(b"\xf6") @@ -224,10 +213,6 @@ def test_echo_color_flag(monkeypatch, capfd): def test_echo_writing_to_standard_error(capfd, monkeypatch): def emulate_input(text): """Emulate keyboard input.""" - if sys.version_info[0] == 2: - from StringIO import StringIO - else: - from io import StringIO monkeypatch.setattr(sys, "stdin", StringIO(text)) click.echo("Echo to standard output") |