Skip to content

Commit 38af5d3

Browse files
committed
Handle the differences in how Python 2 vs 3 handle outputting strings
1 parent 2207ce3 commit 38af5d3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tests/test_command.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_which_none(self):
4848
def test_run_ls(self):
4949
response = command.run(['ls', test_path])
5050
assert response.exit == 0
51-
assert response.output == """\
51+
assert response.output == b"""\
5252
__pycache__
5353
test_command.py"""
5454

@@ -71,11 +71,17 @@ def debug_print(line):
7171
out, err = capsys.readouterr()
7272

7373
assert response.exit == 0
74-
assert response.output == """\
74+
assert response.output == b"""\
7575
__pycache__
7676
test_command.py"""
77-
assert out == """\
77+
78+
# Pyton 2 vs 3 handles strings in different ways
79+
if sys.version_info.major is 2:
80+
assert out == b"""\
7881
__pycache__
7982
test_command.py
8083
"""
84+
elif sys.version_info.major is 3:
85+
assert out == "b'__pycache__'\nb'test_command.py'\n"
86+
8187
assert err == ''

0 commit comments

Comments
 (0)