[Python-checkins] bpo-44451: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_index (GH-26784)
jaraco
webhook-mailer at python.org
Fri Jun 18 16:02:54 EDT 2021
https://github.com/python/cpython/commit/df1502e47fc1e0cf1e7d460ae04530c3e2e4a7c6
commit: df1502e47fc1e0cf1e7d460ae04530c3e2e4a7c6
branch: main
author: Miro Hrončok <miro at hroncok.cz>
committer: jaraco <jaraco at jaraco.com>
date: 2021-06-18T16:02:45-04:00
summary:
bpo-44451: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_index (GH-26784)
This avoids the following error if DeprecationWarnings are ignored.
======================================================================
ERROR: test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests)
Prior versions of Distribution.entry_points would return a
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/Python-3.10.0b3/Lib/test/test_importlib/test_metadata_api.py", line 145, in test_entry_points_by_index
expected = next(iter(caught))
StopIteration
----------------------------------------------------------------------
Ran 1402 tests in 2.125s
FAILED (errors=1, skipped=18, expected failures=1)
files:
A Misc/NEWS.d/next/Tests/2021-06-18-15-19-35.bpo-44451.aj5pqE.rst
M Lib/test/test_importlib/test_metadata_api.py
diff --git a/Lib/test/test_importlib/test_metadata_api.py b/Lib/test/test_importlib/test_metadata_api.py
index 3506493463d82e..2bfc44b18eedb4 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 00000000000000..0f635cfe18d141
--- /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.
More information about the Python-checkins
mailing list