]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44451: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_in...
authorMiro Hrončok <miro@hroncok.cz>
Fri, 18 Jun 2021 20:02:45 +0000 (22:02 +0200)
committerGitHub <noreply@github.com>
Fri, 18 Jun 2021 20:02:45 +0000 (16:02 -0400)
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)

Lib/test/test_importlib/test_metadata_api.py
Misc/NEWS.d/next/Tests/2021-06-18-15-19-35.bpo-44451.aj5pqE.rst [new file with mode: 0644]

index 3506493463d82ec395b7bee54f4bf988342c5cec..2bfc44b18eedb4dcea3705f9efc2a3931412feab 100644 (file)
@@ -139,6 +139,7 @@ class APITests(
         """
         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 (file)
index 0000000..0f635cf
--- /dev/null
@@ -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.