From cce94e3a8b9a1344a8c6f504ef08fd6ea4d14b87 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sun, 19 Jul 2020 17:02:06 +0900 Subject: [PATCH 1/3] bpo-41338: Fix warnings in test_decimal --- Lib/test/test_decimal.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 9dbae449fb61d9..5d0992a66e6cea 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -38,6 +38,7 @@ from test.support import (TestFailed, run_with_locale, cpython_only) from test.support.import_helper import import_fresh_module +from test.support import warnings_helper import random import inspect import threading @@ -584,6 +585,7 @@ def test_explicit_from_string(self): @cpython_only @requires_legacy_unicode_capi + @warnings_helper.ignore_warnings(category=DeprecationWarning) def test_from_legacy_strings(self): import _testcapi Decimal = self.decimal.Decimal @@ -2820,6 +2822,7 @@ def test_none_args(self): @cpython_only @requires_legacy_unicode_capi + @warnings_helper.ignore_warnings(category=DeprecationWarning) def test_from_legacy_strings(self): import _testcapi c = self.decimal.Context() From bf34f1667c99d08c1a62febef50098ad4581694b Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sun, 19 Jul 2020 17:07:25 +0900 Subject: [PATCH 2/3] Fix test_csv --- Lib/test/test_csv.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index a92870c24a1b45..38160220853ea8 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -10,6 +10,7 @@ import gc import pickle from test import support +from test.support import warnings_helper from itertools import permutations from textwrap import dedent from collections import OrderedDict @@ -251,6 +252,7 @@ def test_writerows_errors(self): @support.cpython_only @support.requires_legacy_unicode_capi + @warnings_helper.ignore_warnings(category=DeprecationWarning) def test_writerows_legacy_strings(self): import _testcapi c = _testcapi.unicode_legacy_string('a') From 3cb750bff4760f757d095af28dfa4ec78e8f7649 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sun, 19 Jul 2020 17:21:14 +0900 Subject: [PATCH 3/3] Fix test_capi --- Lib/test/test_capi.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 55027c9cbcd43a..892cc74ec39158 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -19,6 +19,7 @@ from test.support import MISSING_C_DOCSTRINGS from test.support import import_helper from test.support import threading_helper +from test.support import warnings_helper from test.support.script_helper import assert_python_failure, assert_python_ok try: import _posixsubprocess @@ -700,6 +701,11 @@ class Test_testcapi(unittest.TestCase): for name in dir(_testcapi) if name.startswith('test_') and not name.endswith('_code')) + # Suppress warning from PyUnicode_FromUnicode(). + @warnings_helper.ignore_warnings(category=DeprecationWarning) + def test_widechar(self): + _testcapi.test_widechar() + class Test_testinternalcapi(unittest.TestCase): locals().update((name, getattr(_testinternalcapi, name))