From 2da34acf8204d15665f4220e099a1011ac6b7d4e Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Sat, 4 Sep 2021 05:34:13 +0530 Subject: [PATCH] use _cosmo module to skip erroring tests --- third_party/python/Lib/test/test_code.py | 7 +++---- third_party/python/Lib/test/test_dict.py | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/third_party/python/Lib/test/test_code.py b/third_party/python/Lib/test/test_code.py index f0db3f5fd..e062d5540 100644 --- a/third_party/python/Lib/test/test_code.py +++ b/third_party/python/Lib/test/test_code.py @@ -102,6 +102,7 @@ consts: ('None',) """ +import _cosmo import inspect import sys try: @@ -298,9 +299,8 @@ if check_impl_detail(cpython=True) and ctypes is not None: # away, so we eval a lambda. return eval('lambda:42') + @unittest.skipUnless(_cosmo.MODE == "dbg", "requires APE debug build") def test_get_non_code(self): - return - # TODO: have a sysconfig check to run this test in dbg # f = self.get_func() self.assertRaises(SystemError, SetExtra, 42, FREE_INDEX, @@ -308,9 +308,8 @@ if check_impl_detail(cpython=True) and ctypes is not None: self.assertRaises(SystemError, GetExtra, 42, FREE_INDEX, ctypes.c_voidp(100)) + @unittest.skipUnless(_cosmo.MODE == "dbg", "requires APE debug build") def test_bad_index(self): - return - # TODO: have a sysconfig check to run this test in dbg # f = self.get_func() self.assertRaises(SystemError, SetExtra, f.__code__, FREE_INDEX+100, ctypes.c_voidp(100)) diff --git a/third_party/python/Lib/test/test_dict.py b/third_party/python/Lib/test/test_dict.py index 8e8cdb32b..caac0a4fb 100644 --- a/third_party/python/Lib/test/test_dict.py +++ b/third_party/python/Lib/test/test_dict.py @@ -1,3 +1,4 @@ +import _cosmo import collections import collections.abc import gc @@ -1221,8 +1222,8 @@ class CAPITest(unittest.TestCase): self.assertEqual(dict_getitem_knownhash(d, 'z', hash('z')), 3) # not a dict - # TODO: have a sysconfig check to run this test in dbg # - if False: + # find the APE compilation mode, run this test in dbg only # + if _cosmo.MODE == "dbg": self.assertRaises(SystemError, dict_getitem_knownhash, [], 1, hash(1)) # key does not exist self.assertRaises(KeyError, dict_getitem_knownhash, {}, 1, hash(1))