gh-117089: Move importlib.metadata tests to their own package (#117092)

* Ensure importlib.metadata tests do not leak references in sys.modules.

* Move importlib.metadata tests to their own package for easier syncing with importlib_metadata.

* Update owners and makefile for new directories.

* Add blurb
This commit is contained in:
Jason R. Coombs 2024-03-20 17:11:00 -04:00 committed by GitHub
parent 7d446548ef
commit 8ad8898420
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 7 additions and 3 deletions

2
.github/CODEOWNERS vendored
View File

@ -119,7 +119,7 @@ Python/dynload_*.c @ericsnowcurrently
Lib/test/test_module/ @ericsnowcurrently Lib/test/test_module/ @ericsnowcurrently
Doc/c-api/module.rst @ericsnowcurrently Doc/c-api/module.rst @ericsnowcurrently
**/*importlib/resources/* @jaraco @warsaw @FFY00 **/*importlib/resources/* @jaraco @warsaw @FFY00
**/importlib/metadata/* @jaraco @warsaw **/*importlib/metadata/* @jaraco @warsaw
# Dates and times # Dates and times
**/*datetime* @pganssle @abalkin **/*datetime* @pganssle @abalkin

View File

@ -9,6 +9,7 @@ import textwrap
import functools import functools
import contextlib import contextlib
from test.support import import_helper
from test.support.os_helper import FS_NONASCII from test.support.os_helper import FS_NONASCII
from test.support import requires_zlib from test.support import requires_zlib
@ -85,6 +86,7 @@ class OnSysPath(Fixtures):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.fixtures.enter_context(self.add_sys_path(self.site_dir)) self.fixtures.enter_context(self.add_sys_path(self.site_dir))
self.fixtures.enter_context(import_helper.isolated_modules())
class SiteBuilder(SiteDir): class SiteBuilder(SiteDir):
@ -348,7 +350,7 @@ def DALS(str):
@requires_zlib() @requires_zlib()
class ZipFixtures: class ZipFixtures:
root = 'test.test_importlib.data' root = 'test.test_importlib.metadata.data'
def _fixture_on_path(self, filename): def _fixture_on_path(self, filename):
pkg_file = resources.files(self.root).joinpath(filename) pkg_file = resources.files(self.root).joinpath(filename)

View File

@ -2351,10 +2351,11 @@ TESTSUBDIRS= idlelib/idle_test \
test/test_import/data/unwritable \ test/test_import/data/unwritable \
test/test_importlib \ test/test_importlib \
test/test_importlib/builtin \ test/test_importlib/builtin \
test/test_importlib/data \
test/test_importlib/extension \ test/test_importlib/extension \
test/test_importlib/frozen \ test/test_importlib/frozen \
test/test_importlib/import_ \ test/test_importlib/import_ \
test/test_importlib/metadata \
test/test_importlib/metadata/data \
test/test_importlib/namespace_pkgs \ test/test_importlib/namespace_pkgs \
test/test_importlib/namespace_pkgs/both_portions \ test/test_importlib/namespace_pkgs/both_portions \
test/test_importlib/namespace_pkgs/both_portions/foo \ test/test_importlib/namespace_pkgs/both_portions/foo \

View File

@ -0,0 +1 @@
Consolidated tests for importlib.metadata in their own ``metadata`` package.