]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-138313: Suppress ResourceWarnings and restore skipped test (#138597)
authorJason R. Coombs <jaraco@jaraco.com>
Mon, 22 Sep 2025 00:53:57 +0000 (20:53 -0400)
committerGitHub <noreply@github.com>
Mon, 22 Sep 2025 00:53:57 +0000 (20:53 -0400)
Lib/test/test_importlib/metadata/_issue138313.py [deleted file]
Lib/test/test_importlib/metadata/fixtures.py
Lib/test/test_importlib/metadata/test_main.py
Misc/NEWS.d/next/Tests/2025-09-21-16-00-30.gh-issue-138313.lBx2en.rst [new file with mode: 0644]

diff --git a/Lib/test/test_importlib/metadata/_issue138313.py b/Lib/test/test_importlib/metadata/_issue138313.py
deleted file mode 100644 (file)
index 4e1c57e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-import os
-import unittest
-
-
-def skip_on_buildbot(func):
-    """
-    #132947 revealed that after applying some otherwise stable
-    changes, only on some buildbot runners, the tests will fail with
-    ResourceWarnings.
-    """
-    # detect "not github actions" as a proxy for BUILDBOT not being present yet.
-    is_buildbot = "GITHUB_ACTION" not in os.environ or "BUILDBOT" in os.environ
-    skipper = unittest.skip("Causes Resource Warnings (python/cpython#132947)")
-    wrapper = skipper if is_buildbot else lambda x: x
-    return wrapper(func)
index 494047dc98f9b6c2415a74845387666b1aef499e..ad0ab42e089a9d3603178f0b79578f2019431f95 100644 (file)
@@ -374,6 +374,8 @@ class ZipFixtures:
         # Add self.zip_name to the front of sys.path.
         self.resources = contextlib.ExitStack()
         self.addCleanup(self.resources.close)
+        # workaround for #138313
+        self.addCleanup(lambda: None)
 
 
 def parameterize(*args_set):
index 71bdd5f0d259434ba67142aed9c324ce0e0df209..83b686babfdb7aebf6f83a35afed3fce560f95f0 100644 (file)
@@ -22,7 +22,6 @@ from importlib.metadata import (
 )
 
 from . import fixtures
-from . import _issue138313
 from ._path import Symlink
 
 
@@ -358,7 +357,6 @@ class PackagesDistributionsPrebuiltTest(fixtures.ZipFixtures, unittest.TestCase)
         self._fixture_on_path('example-21.12-py3-none-any.whl')
         assert packages_distributions()['example'] == ['example']
 
-    @_issue138313.skip_on_buildbot
     def test_packages_distributions_example2(self):
         """
         Test packages_distributions on a wheel built
diff --git a/Misc/NEWS.d/next/Tests/2025-09-21-16-00-30.gh-issue-138313.lBx2en.rst b/Misc/NEWS.d/next/Tests/2025-09-21-16-00-30.gh-issue-138313.lBx2en.rst
new file mode 100644 (file)
index 0000000..b70c592
--- /dev/null
@@ -0,0 +1,2 @@
+Restore skipped test and add janky workaround to prevent select buildbots
+from failing with a ResourceWarning.