|
21 | 21 | import sys |
22 | 22 | import unittest |
23 | 23 |
|
24 | | -from iptest import IronPythonTestCase, is_cli, is_cpython, is_mono, is_netcoreapp, is_posix, run_test, skipUnlessIronPython |
| 24 | +from iptest import IronPythonTestCase, is_cli, is_cpython, is_mono, is_netcoreapp, is_posix, is_linux, is_windows, run_test, skipUnlessIronPython |
25 | 25 | from iptest.misc_util import ip_supported_encodings |
26 | 26 |
|
| 27 | +if is_cpython and is_linux: |
| 28 | + import time |
| 29 | + |
27 | 30 | class CodecTest(IronPythonTestCase): |
28 | 31 | def test_escape_decode(self): |
29 | 32 | # escape_decode decodes bytes to bytes, but when given a string it encodes it first with UTF-8 |
@@ -529,13 +532,19 @@ def test_unicode_internal_encode(self): |
529 | 532 | # takes one or two parameters, not zero or three |
530 | 533 | self.assertRaises(TypeError, codecs.unicode_internal_encode) |
531 | 534 | self.assertRaises(TypeError, codecs.unicode_internal_encode, 'abc', 'def', 'qrt') |
532 | | - self.assertEqual(codecs.unicode_internal_encode('abc'), (b'a\x00b\x00c\x00', 3)) |
| 535 | + if is_cli or is_windows: |
| 536 | + self.assertEqual(codecs.unicode_internal_encode('abc'), (b'a\x00b\x00c\x00', 3)) |
| 537 | + else: |
| 538 | + self.assertEqual(codecs.unicode_internal_encode('abc'), (b'a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00', 3)) |
533 | 539 |
|
534 | 540 | def test_unicode_internal_decode(self): |
535 | 541 | # takes one or two parameters, not zero or three |
536 | 542 | self.assertRaises(TypeError, codecs.unicode_internal_decode) |
537 | 543 | self.assertRaises(TypeError, codecs.unicode_internal_decode, 'abc', 'def', 'qrt') |
538 | | - self.assertEqual(codecs.unicode_internal_decode(b'ab'), ('\u6261', 2)) |
| 544 | + if is_cli or is_windows: |
| 545 | + self.assertEqual(codecs.unicode_internal_decode(b'ab'), ('\u6261', 2)) |
| 546 | + else: |
| 547 | + self.assertEqual(codecs.unicode_internal_decode(b'ab\0\0'), ('\u6261', 4)) |
539 | 548 |
|
540 | 549 | def test_utf_16_be_decode(self): |
541 | 550 | string, num_processed = codecs.utf_16_be_decode(b'\0a\0b\0c') |
@@ -949,6 +958,8 @@ def test_file_encodings(self): |
949 | 958 |
|
950 | 959 | f.write("# coding: %s" % (coding)) |
951 | 960 |
|
| 961 | + if is_cpython and is_linux: |
| 962 | + time.sleep(0.01) |
952 | 963 | __import__(temp_mod_name) |
953 | 964 | os.remove(os.path.join(self.temporary_dir, "tmp_encodings", temp_mod_name + ".py")) |
954 | 965 |
|
|
0 commit comments