Skip to content

Commit bf55a79

Browse files
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) (cherry picked from commit df1502e) Co-authored-by: Miro Hrončok <[email protected]>
1 parent bba7267 commit bf55a79

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Lib/test/test_importlib/test_metadata_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def test_entry_points_by_index(self):
139139
"""
140140
eps = distribution('distinfo-pkg').entry_points
141141
with warnings.catch_warnings(record=True) as caught:
142+
warnings.filterwarnings("default", category=DeprecationWarning)
142143
eps[0]
143144

144145
# check warning
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Reset ``DeprecationWarning`` filters in
2+
``test.test_importlib.test_metadata_api.APITests.test_entry_points_by_index``
3+
to avoid ``StopIteration`` error if ``DeprecationWarnings`` are ignored.

0 commit comments

Comments
 (0)