|
2 | 2 | import unittest
|
3 | 3 | import dis
|
4 | 4 | from test import support
|
5 |
| -from test.support import import_helper, requires_specialization, requires_specialization_ft |
| 5 | +from test.support import ( |
| 6 | + import_helper, requires_specialization, |
| 7 | + requires_specialization_ft, warnings_helper |
| 8 | +) |
6 | 9 | try:
|
7 | 10 | from sys import _clear_type_cache
|
8 | 11 | except ImportError:
|
|
15 | 18 | type_assign_specific_version_unsafe = _testinternalcapi.type_assign_specific_version_unsafe
|
16 | 19 | type_assign_version = _testcapi.type_assign_version
|
17 | 20 | type_modified = _testcapi.type_modified
|
| 21 | +ignore_deprecation = warnings_helper.ignore_warnings( |
| 22 | + category=DeprecationWarning |
| 23 | +) |
18 | 24 |
|
19 | 25 |
|
20 | 26 | @support.cpython_only
|
21 | 27 | @unittest.skipIf(_clear_type_cache is None, "requires sys._clear_type_cache")
|
22 | 28 | class TypeCacheTests(unittest.TestCase):
|
23 |
| - @support.ignore_warnings(category=DeprecationWarning) |
| 29 | + @ignore_deprecation |
24 | 30 | def test_tp_version_tag_unique(self):
|
25 | 31 | """tp_version_tag should be unique assuming no overflow, even after
|
26 | 32 | clearing type cache.
|
@@ -62,7 +68,7 @@ class C:
|
62 | 68 | self.assertNotEqual(type_get_version(C), 0)
|
63 | 69 | self.assertNotEqual(type_get_version(C), c_ver)
|
64 | 70 |
|
65 |
| - @support.ignore_warnings(category=DeprecationWarning) |
| 71 | + @ignore_deprecation |
66 | 72 | def test_type_assign_specific_version(self):
|
67 | 73 | """meta-test for type_assign_specific_version_unsafe"""
|
68 | 74 | class C:
|
@@ -114,7 +120,7 @@ class HolderSub(Holder):
|
114 | 120 | @support.cpython_only
|
115 | 121 | class TypeCacheWithSpecializationTests(unittest.TestCase):
|
116 | 122 |
|
117 |
| - @support.ignore_warnings(category=DeprecationWarning) |
| 123 | + @ignore_deprecation |
118 | 124 | def tearDown(self):
|
119 | 125 | _clear_type_cache()
|
120 | 126 |
|
|
0 commit comments