use python-independent system test
Markus Gerstel
5 years ago
18 | 18 | assert result['stderr'] == b'' |
19 | 19 | |
20 | 20 | 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) | |
26 | 27 | assert result['exitcode'] == 0 |
27 | 28 | 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 | |
29 | 34 | out, err = capsys.readouterr() |
30 | 35 | assert out == u'test\ufffdstring\n' |
31 | 36 | assert err == u'' |