cpython/Lib/test/test_importlib/metadata/_issue138313.py
Jason R. Coombs 9b38c6698a
Reapply "gh-132947: Apply changes from importlib_metadata 8.7 (#137885)" (#137924) (#137930)
* Reapply "gh-132947: Apply changes from importlib_metadata 8.7 (#137885)" (#137924)

This reverts commit 3706ef66ef.

* Skip the triggering test on buildbots only.
2025-09-01 11:27:01 -04:00

15 lines
546 B
Python

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)