1717import weakref
1818from cinder import cached_property , strict_module_patch , StrictModule
1919from types import CodeType , FunctionType
20- from unittest import skipIf
20+ from unittest import skipIf , skipUnless
2121
2222import cinderx .jit
2323from test .support .script_helper import assert_python_ok , run_python_until_end
@@ -3071,7 +3071,7 @@ def f(x):
30713071 obj2 .__class__ = Foo
30723072 self .assertEqual (f (obj2 ), 200 )
30733073
3074- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3074+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
30753075 def test_load_immortal_classmethod (self ) -> None :
30763076 code = f"""if 1:
30773077 class Foo:
@@ -3094,7 +3094,7 @@ def f(x):
30943094 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
30953095 self .assertEqual (out .strip (), b"100" )
30963096
3097- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3097+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
30983098 def test_load_immortal_staticmethod (self ) -> None :
30993099 code = f"""if 1:
31003100 class Foo:
@@ -3117,7 +3117,7 @@ def f(x):
31173117 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
31183118 self .assertEqual (out .strip (), b"100" )
31193119
3120- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3120+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
31213121 def test_load_immortal_wrapper_descr (self ) -> None :
31223122 code = f"""if 1:
31233123 class Foo:
@@ -3139,7 +3139,7 @@ def f():
31393139 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
31403140 self .assertEqual (out .strip (), b"'hello'" )
31413141
3142- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3142+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
31433143 def test_load_immortal_function (self ) -> None :
31443144 code = f"""if 1:
31453145 class Oracle:
@@ -3161,7 +3161,7 @@ def f():
31613161 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
31623162 self .assertEqual (out .strip (), b"42" )
31633163
3164- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3164+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
31653165 def test_load_immortal_method_descriptor (self ) -> None :
31663166 code = f"""if 1:
31673167 import gc
@@ -3180,7 +3180,7 @@ def f(l):
31803180 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
31813181 self .assertEqual (out .strip (), b"42" )
31823182
3183- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3183+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
31843184 def test_load_immortal_builtin_function (self ) -> None :
31853185 code = f"""if 1:
31863186 class Foo:
@@ -3201,7 +3201,7 @@ def f():
32013201 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
32023202 self .assertEqual (out .strip (), b"True" )
32033203
3204- @skipIf (not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3204+ @skipIf (not hasattr (gc , "immortalize_heap " ), "no immortalization" )
32053205 def test_load_unshadowed_immortal_method_split_dict (self ) -> None :
32063206 code = f"""if 1:
32073207 class Oracle:
@@ -3226,7 +3226,7 @@ def f(x):
32263226 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
32273227 self .assertEqual (out .strip (), b"42" )
32283228
3229- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3229+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
32303230 def test_load_shadowed_immortal_method_split_dict (self ) -> None :
32313231 code = f"""if 1:
32323232 class Oracle:
@@ -3255,7 +3255,7 @@ def f(x):
32553255 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
32563256 self .assertEqual (out .strip (), b"42" )
32573257
3258- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3258+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
32593259 def test_load_unshadowed_immortal_method_combineddict (self ) -> None :
32603260 code = f"""if 1:
32613261 class Oracle:
@@ -3285,7 +3285,7 @@ def f(x):
32853285 rc , out , err = assert_python_ok ("-c" , code )
32863286 self .assertEqual (out .strip (), b"42" )
32873287
3288- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3288+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
32893289 def test_load_shadowed_immortal_method_combineddict (self ) -> None :
32903290 code = f"""if 1:
32913291 class Oracle:
@@ -3319,7 +3319,7 @@ def f(x):
33193319 rc , out , err = skip_ret_code_check_for_leaking_test_in_asan_mode ("-c" , code )
33203320 self .assertEqual (out .strip (), b"42" )
33213321
3322- @skipIf ( not hasattr ("gc" , "is_immortal " ), "no immortalization" )
3322+ @skipUnless ( hasattr (gc , "immortalize_heap " ), "no immortalization" )
33233323 def test_load_unshadowed_immortal_method_no_dict (self ) -> None :
33243324 code = f"""if 1:
33253325 import gc
0 commit comments