|
1 | 1 | import builtins |
2 | 2 | import codecs |
3 | | -# import _datetime # TODO: RUSTPYTHON |
4 | 3 | import gc |
5 | 4 | import io |
6 | 5 | import locale |
@@ -210,7 +209,7 @@ class SysModuleTest(unittest.TestCase): |
210 | 209 | def tearDown(self): |
211 | 210 | test.support.reap_children() |
212 | 211 |
|
213 | | - @unittest.expectedFailure # TODO: RUSTPYTHON |
| 212 | + @unittest.expectedFailure # TODO: RUSTPYTHON; latin-1 codec not registered |
214 | 213 | def test_exit(self): |
215 | 214 | # call with two arguments |
216 | 215 | self.assertRaises(TypeError, sys.exit, 42, 42) |
@@ -352,7 +351,7 @@ def test_setrecursionlimit(self): |
352 | 351 | finally: |
353 | 352 | sys.setrecursionlimit(old_limit) |
354 | 353 |
|
355 | | - @unittest.skipIf(getattr(sys, '_rustpython_debugbuild', False), 'TODO: RUSTPYTHON; stack overflow on debug build') |
| 354 | + @unittest.skipIf(getattr(sys, "_rustpython_debugbuild", False), "TODO: RUSTPYTHON; stack overflow on debug build") |
356 | 355 | def test_recursionlimit_recovery(self): |
357 | 356 | if hasattr(sys, 'gettrace') and sys.gettrace(): |
358 | 357 | self.skipTest('fatal error if run with a trace function') |
@@ -433,7 +432,6 @@ def test_getwindowsversion(self): |
433 | 432 | # still has 5 elements |
434 | 433 | maj, min, buildno, plat, csd = sys.getwindowsversion() |
435 | 434 |
|
436 | | - @unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'sys' has no attribute 'call_tracing' |
437 | 435 | def test_call_tracing(self): |
438 | 436 | self.assertRaises(TypeError, sys.call_tracing, type, 2) |
439 | 437 |
|
@@ -499,8 +497,6 @@ def test_getframemodulename(self): |
499 | 497 | self.assertIsNone(sys._getframemodulename(i)) |
500 | 498 |
|
501 | 499 | # sys._current_frames() is a CPython-only gimmick. |
502 | | - # XXX RUSTPYTHON: above comment is from original cpython test; not sure why the cpython_only decorator wasn't added |
503 | | - @test.support.cpython_only |
504 | 500 | @threading_helper.reap_threads |
505 | 501 | @threading_helper.requires_working_threading() |
506 | 502 | def test_current_frames(self): |
@@ -568,7 +564,6 @@ def g456(): |
568 | 564 | leave_g.set() |
569 | 565 | t.join() |
570 | 566 |
|
571 | | - @unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'sys' has no attribute '_current_exceptions' |
572 | 567 | @threading_helper.reap_threads |
573 | 568 | @threading_helper.requires_working_threading() |
574 | 569 | def test_current_exceptions(self): |
@@ -856,7 +851,7 @@ def test_subinterp_intern_singleton(self): |
856 | 851 | ''')) |
857 | 852 | self.assertTrue(sys._is_interned(s)) |
858 | 853 |
|
859 | | - @unittest.expectedFailure # TODO: RUSTPYTHON; needs update for context_aware_warnings |
| 854 | + @unittest.expectedFailure # TODO: RUSTPYTHON; needs update for context_aware_warnings |
860 | 855 | def test_sys_flags(self): |
861 | 856 | self.assertTrue(sys.flags) |
862 | 857 | attrs = ("debug", |
@@ -897,7 +892,7 @@ def test_clear_type_cache(self): |
897 | 892 | r"sys\._clear_type_cache\(\) is deprecated.*"): |
898 | 893 | sys._clear_type_cache() |
899 | 894 |
|
900 | | - @unittest.skip('TODO: RUSTPYTHON; cp424 encoding not supported, causes panic') |
| 895 | + @unittest.skip("TODO: RUSTPYTHON; cp424 encoding not supported, causes panic") |
901 | 896 | @force_not_colorized |
902 | 897 | @support.requires_subprocess() |
903 | 898 | def test_ioencoding(self): |
@@ -1062,12 +1057,12 @@ def check_locale_surrogateescape(self, locale): |
1062 | 1057 | 'stdout: surrogateescape\n' |
1063 | 1058 | 'stderr: backslashreplace\n') |
1064 | 1059 |
|
1065 | | - @unittest.expectedFailure # TODO: RUSTPYTHON |
| 1060 | + @unittest.expectedFailure # TODO: RUSTPYTHON; stderr: backslashreplace |
1066 | 1061 | @support.requires_subprocess() |
1067 | 1062 | def test_c_locale_surrogateescape(self): |
1068 | 1063 | self.check_locale_surrogateescape('C') |
1069 | 1064 |
|
1070 | | - @unittest.expectedFailure # TODO: RUSTPYTHON |
| 1065 | + @unittest.expectedFailure # TODO: RUSTPYTHON; stderr: backslashreplace |
1071 | 1066 | @support.requires_subprocess() |
1072 | 1067 | def test_posix_locale_surrogateescape(self): |
1073 | 1068 | self.check_locale_surrogateescape('POSIX') |
@@ -1192,7 +1187,6 @@ def __del__(self): |
1192 | 1187 | rc, stdout, stderr = assert_python_ok('-c', code) |
1193 | 1188 | self.assertEqual(stdout.rstrip(), b'True') |
1194 | 1189 |
|
1195 | | - @unittest.expectedFailure # TODO: RUSTPYTHON; IndexError: list index out of range |
1196 | 1190 | def test_issue20602(self): |
1197 | 1191 | # sys.flags and sys.float_info were wiped during shutdown. |
1198 | 1192 | code = """if 1: |
@@ -1225,7 +1219,7 @@ def __del__(self): |
1225 | 1219 | self.assertEqual(stdout.rstrip(), b"") |
1226 | 1220 | self.assertEqual(stderr.rstrip(), b"") |
1227 | 1221 |
|
1228 | | - @unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'sys' has no attribute 'getandroidapilevel' |
| 1222 | + @unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'sys' has no attribute 'getandroidapilevel' |
1229 | 1223 | @unittest.skipUnless(sys.platform == "android", "Android only") |
1230 | 1224 | def test_getandroidapilevel(self): |
1231 | 1225 | level = sys.getandroidapilevel() |
@@ -1494,6 +1488,7 @@ def hook_func(args): |
1494 | 1488 | def test_custom_unraisablehook_fail(self): |
1495 | 1489 | _testcapi = import_helper.import_module('_testcapi') |
1496 | 1490 | from _testcapi import err_writeunraisable |
| 1491 | + |
1497 | 1492 | def hook_func(*args): |
1498 | 1493 | raise Exception("hook_func failed") |
1499 | 1494 |
|
@@ -1742,7 +1737,12 @@ def delx(self): del self.__x |
1742 | 1737 | x = property(getx, setx, delx, "") |
1743 | 1738 | check(x, size('5Pi')) |
1744 | 1739 | # PyCapsule |
1745 | | - check(_datetime.datetime_CAPI, size('6P')) |
| 1740 | + try: |
| 1741 | + import _datetime |
| 1742 | + except ModuleNotFoundError: |
| 1743 | + pass |
| 1744 | + else: |
| 1745 | + check(_datetime.datetime_CAPI, size('6P')) |
1746 | 1746 | # rangeiterator |
1747 | 1747 | check(iter(range(1)), size('3l')) |
1748 | 1748 | check(iter(range(2**65)), size('3P')) |
@@ -2227,7 +2227,7 @@ def test_jit_is_enabled(self): |
2227 | 2227 | assert_python_ok("-c", script.format(enabled=False), PYTHON_JIT="0") |
2228 | 2228 | assert_python_ok("-c", script.format(enabled=available), PYTHON_JIT="1") |
2229 | 2229 |
|
2230 | | - @unittest.expectedFailure # TODO: RUSTPYTHON |
| 2230 | + @unittest.expectedFailure # TODO: RUSTPYTHON; --- |
2231 | 2231 | def test_jit_is_active(self): |
2232 | 2232 | available = sys._jit.is_available() |
2233 | 2233 | script = textwrap.dedent( |
|
0 commit comments