From 43357c256e52aef9ba706b88fa3435ed59add76b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 6 Sep 2025 15:03:32 -0400 Subject: [PATCH 1/5] Remove workaround. --- Lib/test/test_importlib/metadata/test_main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lib/test/test_importlib/metadata/test_main.py b/Lib/test/test_importlib/metadata/test_main.py index 71bdd5f0d25943..83b686babfdb7a 100644 --- a/Lib/test/test_importlib/metadata/test_main.py +++ b/Lib/test/test_importlib/metadata/test_main.py @@ -22,7 +22,6 @@ ) from . import fixtures -from . import _issue138313 from ._path import Symlink @@ -358,7 +357,6 @@ def test_packages_distributions_example(self): 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 From b6822683503a8feb372f4b64a169509892078504 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Sep 2025 14:13:15 -0400 Subject: [PATCH 2/5] Remove workaround module. --- Lib/test/test_importlib/metadata/_issue138313.py | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 Lib/test/test_importlib/metadata/_issue138313.py diff --git a/Lib/test/test_importlib/metadata/_issue138313.py b/Lib/test/test_importlib/metadata/_issue138313.py deleted file mode 100644 index 4e1c57e622d657..00000000000000 --- a/Lib/test/test_importlib/metadata/_issue138313.py +++ /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) From e8eb0d03448c6c817e781934282c2545d8e1a3d8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Sep 2025 14:15:20 -0400 Subject: [PATCH 3/5] Add a no-op in ZipFixture teardown. Seems to prevent the failure by giving the zip resource time to be garbage collected. --- Lib/test/test_importlib/metadata/fixtures.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_importlib/metadata/fixtures.py b/Lib/test/test_importlib/metadata/fixtures.py index 494047dc98f9b6..ad0ab42e089a9d 100644 --- a/Lib/test/test_importlib/metadata/fixtures.py +++ b/Lib/test/test_importlib/metadata/fixtures.py @@ -374,6 +374,8 @@ def setUp(self): # 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): From b86082ae9dc405ed73f9b7d2e1d606ee9e5ffdc1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Sep 2025 16:00:37 -0400 Subject: [PATCH 4/5] Add blurb --- Dockerfile | 54 +++++++++++++++++++ ...-09-21-16-00-30.gh-issue-138313.lBx2en.rst | 2 + test-results.xml | 1 + 3 files changed, 57 insertions(+) create mode 100644 Dockerfile create mode 100644 Misc/NEWS.d/next/Tests/2025-09-21-16-00-30.gh-issue-138313.lBx2en.rst create mode 100644 test-results.xml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000000..38423373fcff16 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +# Use AlmaLinux 8, a 1:1 RHEL 8 compatible OS with standard repositories +FROM almalinux:8 + +# Set an environment variable to run dnf without prompts +ENV DNF_ASSUMEYES=1 + +# Install build dependencies for CPython +RUN dnf update -y && \ + # --- FIX STARTS HERE --- + # Install the DNF plugins package which provides the 'config-manager' command + dnf install -y dnf-plugins-core && \ + # --- FIX ENDS HERE --- + # Enable the 'powertools' repository, which is the AlmaLinux equivalent of CRB + dnf config-manager --set-enabled powertools && \ + # Now, install all the packages + dnf install -y \ + gcc \ + make \ + git \ + findutils \ + zlib-devel \ + bzip2-devel \ + libffi-devel \ + openssl-devel \ + readline-devel \ + sqlite-devel \ + xz-devel \ + tk-devel && \ + # Clean up dnf cache to reduce image size + dnf clean all + +# Create a non-root user to run the build +RUN useradd --create-home buildbot +USER buildbot +WORKDIR /home/buildbot + +# Clone the CPython repository from GitHub +# We use the 'main' branch, which is what the '3.x' buildbots track. +# --depth 1 creates a shallow clone to save time and space. +RUN git clone --branch main --depth 1 https://github.com/python/cpython.git + +# Set the working directory for the build +WORKDIR /home/buildbot/cpython + +# Configure and build in a single layer +# - Uses the exact configure flags from the buildbot: --with-pydebug and --with-lto +# - make -j$(nproc) builds in parallel using all available CPU cores +RUN ./configure --with-pydebug --with-lto && \ + make -j$(nproc) + +# Set the environment variable to unlock the failure mode. +ENV GITHUB_ACTION=fake + +CMD ["make", "test"] 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 index 00000000000000..b70c59201dfe27 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2025-09-21-16-00-30.gh-issue-138313.lBx2en.rst @@ -0,0 +1,2 @@ +Restore skipped test and add janky workaround to prevent select buildbots +from failing with a ResourceWarning. diff --git a/test-results.xml b/test-results.xml new file mode 100644 index 00000000000000..78f2953dc43b9c --- /dev/null +++ b/test-results.xml @@ -0,0 +1 @@ +ignore_environment flag was setignore_environment flag was setignore_environment flag was setignore_environment flag was setpyfakefs not availableDesired but not supported.ignore_environment flag was setignore_environment flag was setignore_environment flag was setignore_environment flag was setnot enough memory: 1.8G minimum needednot enough memory: 1.8G minimum needednot enough memory: 3.7G minimum needednot enough memory: 3.7G minimum needednot enough memory: 3.7G minimum neededtest meaningful only where os.altsep is definedonly applies to candidate or final python release levelstest meaningful only where os.altsep is definedNo module named 'winreg' \ No newline at end of file From c1b46760025db506116f0910e07384c4af30a08c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Sep 2025 17:53:29 -0400 Subject: [PATCH 5/5] Remove dockerfile and test results. --- Dockerfile | 54 ------------------------------------------------ test-results.xml | 1 - 2 files changed, 55 deletions(-) delete mode 100644 Dockerfile delete mode 100644 test-results.xml diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 38423373fcff16..00000000000000 --- a/Dockerfile +++ /dev/null @@ -1,54 +0,0 @@ -# Use AlmaLinux 8, a 1:1 RHEL 8 compatible OS with standard repositories -FROM almalinux:8 - -# Set an environment variable to run dnf without prompts -ENV DNF_ASSUMEYES=1 - -# Install build dependencies for CPython -RUN dnf update -y && \ - # --- FIX STARTS HERE --- - # Install the DNF plugins package which provides the 'config-manager' command - dnf install -y dnf-plugins-core && \ - # --- FIX ENDS HERE --- - # Enable the 'powertools' repository, which is the AlmaLinux equivalent of CRB - dnf config-manager --set-enabled powertools && \ - # Now, install all the packages - dnf install -y \ - gcc \ - make \ - git \ - findutils \ - zlib-devel \ - bzip2-devel \ - libffi-devel \ - openssl-devel \ - readline-devel \ - sqlite-devel \ - xz-devel \ - tk-devel && \ - # Clean up dnf cache to reduce image size - dnf clean all - -# Create a non-root user to run the build -RUN useradd --create-home buildbot -USER buildbot -WORKDIR /home/buildbot - -# Clone the CPython repository from GitHub -# We use the 'main' branch, which is what the '3.x' buildbots track. -# --depth 1 creates a shallow clone to save time and space. -RUN git clone --branch main --depth 1 https://github.com/python/cpython.git - -# Set the working directory for the build -WORKDIR /home/buildbot/cpython - -# Configure and build in a single layer -# - Uses the exact configure flags from the buildbot: --with-pydebug and --with-lto -# - make -j$(nproc) builds in parallel using all available CPU cores -RUN ./configure --with-pydebug --with-lto && \ - make -j$(nproc) - -# Set the environment variable to unlock the failure mode. -ENV GITHUB_ACTION=fake - -CMD ["make", "test"] diff --git a/test-results.xml b/test-results.xml deleted file mode 100644 index 78f2953dc43b9c..00000000000000 --- a/test-results.xml +++ /dev/null @@ -1 +0,0 @@ -ignore_environment flag was setignore_environment flag was setignore_environment flag was setignore_environment flag was setpyfakefs not availableDesired but not supported.ignore_environment flag was setignore_environment flag was setignore_environment flag was setignore_environment flag was setnot enough memory: 1.8G minimum needednot enough memory: 1.8G minimum needednot enough memory: 3.7G minimum needednot enough memory: 3.7G minimum needednot enough memory: 3.7G minimum neededtest meaningful only where os.altsep is definedonly applies to candidate or final python release levelstest meaningful only where os.altsep is definedNo module named 'winreg' \ No newline at end of file