Codebase list python-procrunner / d82e23c
use python-independent system test Markus Gerstel 5 years ago
1 changed file(s) with 11 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1818 assert result['stderr'] == b''
1919
2020 def test_decode_invalid_utf8_input(capsys):
21 command = ['python', '-c', 'import sys;'
22 'sys.stdout.write("".join(chr(x) for x in '
23 '(0x74,0x65,0x73,0x74,0xa0,0x73,0x74,0x72,0x69,0x6e,0x67,0x0a)'
24 '))']
25 result = procrunner.run(command)
21 test_string = b'test\xa0string\n'
22 if os.name == 'nt':
23 command = ['cmd.exe', '/c', 'type', 'CON']
24 else:
25 command = ['cat']
26 result = procrunner.run(command, stdin=test_string)
2627 assert result['exitcode'] == 0
2728 assert not result['stderr']
28 assert result['stdout'] == b'test\xa0string\n'
29 if os.name == 'nt':
30 # Windows modifies line endings
31 assert result['stdout'] == test_string[:-1] + b'\r\n'
32 else:
33 assert result['stdout'] == test_string
2934 out, err = capsys.readouterr()
3035 assert out == u'test\ufffdstring\n'
3136 assert err == u''