From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 18 Jun 2021 15:16:04 +0200 Subject: [PATCH] 00363: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_index This avoids StopIteration error when running tests. https://bugs.python.org/issue44451 --- Lib/test/test_importlib/test_metadata_api.py | 1 + .../NEWS.d/next/Tests/2021-06-18-15-19-35.bpo-44451.aj5pqE.rst | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2021-06-18-15-19-35.bpo-44451.aj5pqE.rst diff --git a/Lib/test/test_importlib/test_metadata_api.py b/Lib/test/test_importlib/test_metadata_api.py index 3506493463..2bfc44b18e 100644 --- a/Lib/test/test_importlib/test_metadata_api.py +++ b/Lib/test/test_importlib/test_metadata_api.py @@ -139,6 +139,7 @@ def test_entry_points_by_index(self): """ eps = distribution('distinfo-pkg').entry_points with warnings.catch_warnings(record=True) as caught: + warnings.filterwarnings("default", category=DeprecationWarning) eps[0] # check warning diff --git a/Misc/NEWS.d/next/Tests/2021-06-18-15-19-35.bpo-44451.aj5pqE.rst b/Misc/NEWS.d/next/Tests/2021-06-18-15-19-35.bpo-44451.aj5pqE.rst new file mode 100644 index 0000000000..0f635cfe18 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2021-06-18-15-19-35.bpo-44451.aj5pqE.rst @@ -0,0 +1,3 @@ +Reset ``DeprecationWarning`` filters in +``test.test_importlib.test_metadata_api.APITests.test_entry_points_by_index`` +to avoid ``StopIteration`` error if ``DeprecationWarnings`` are ignored.