|
9 | 9 | import tempfile |
10 | 10 | import textwrap |
11 | 11 | import unittest |
| 12 | +import warnings |
12 | 13 | from test import support |
13 | 14 | from test.support import os_helper |
14 | 15 | from test.support import force_not_colorized |
@@ -936,14 +937,20 @@ def test_python_asyncio_debug(self): |
936 | 937 | @unittest.skipUnless(sysconfig.get_config_var('Py_TRACE_REFS'), "Requires --with-trace-refs build option") |
937 | 938 | def test_python_dump_refs(self): |
938 | 939 | code = 'import sys; sys._clear_type_cache()' |
939 | | - rc, out, err = assert_python_ok('-c', code, PYTHONDUMPREFS='1') |
| 940 | + # TODO: Remove warnings context manager once sys._clear_type_cache is removed |
| 941 | + with warnings.catch_warnings(): |
| 942 | + warnings.simplefilter("ignore", DeprecationWarning) |
| 943 | + rc, out, err = assert_python_ok('-c', code, PYTHONDUMPREFS='1') |
940 | 944 | self.assertEqual(rc, 0) |
941 | 945 |
|
942 | 946 | @unittest.skipUnless(sysconfig.get_config_var('Py_TRACE_REFS'), "Requires --with-trace-refs build option") |
943 | 947 | def test_python_dump_refs_file(self): |
944 | 948 | with tempfile.NamedTemporaryFile() as dump_file: |
945 | 949 | code = 'import sys; sys._clear_type_cache()' |
946 | | - rc, out, err = assert_python_ok('-c', code, PYTHONDUMPREFSFILE=dump_file.name) |
| 950 | + # TODO: Remove warnings context manager once sys._clear_type_cache is removed |
| 951 | + with warnings.catch_warnings(): |
| 952 | + warnings.simplefilter("ignore", DeprecationWarning) |
| 953 | + rc, out, err = assert_python_ok('-c', code, PYTHONDUMPREFSFILE=dump_file.name) |
947 | 954 | self.assertEqual(rc, 0) |
948 | 955 | with open(dump_file.name, 'r') as file: |
949 | 956 | contents = file.read() |
|
0 commit comments