diff --git a/.gitattributes b/.gitattributes index fb11ddb6dfa..79f7b712aa4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -28,8 +28,8 @@ Lib/test/cjkencodings/* noeol Lib/test/coding20731.py noeol Lib/test/decimaltestdata/*.decTest noeol Lib/test/test_email/data/*.txt noeol -Lib/test/test_importlib/data01/* noeol -Lib/test/test_importlib/namespacedata01/* noeol +Lib/test/test_importlib/resources/data01/* noeol +Lib/test/test_importlib/resources/namespacedata01/* noeol Lib/test/xmltestdata/* noeol # CRLF files diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 013e1cbd724..df79aa6503e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -61,7 +61,7 @@ Python/pythonrun.c @iritkatriel # bytecode. **/*import*.c @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw **/*import*.py @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw -**/importlib/resources/* @jaraco @warsaw @brettcannon +**/*importlib/resources/* @jaraco @warsaw @brettcannon **/importlib/metadata/* @jaraco @warsaw # Dates and times diff --git a/Lib/test/test_importlib/data01/__init__.py b/Lib/test/test_importlib/resources/data01/__init__.py similarity index 100% rename from Lib/test/test_importlib/data01/__init__.py rename to Lib/test/test_importlib/resources/data01/__init__.py diff --git a/Lib/test/test_importlib/data01/binary.file b/Lib/test/test_importlib/resources/data01/binary.file similarity index 100% rename from Lib/test/test_importlib/data01/binary.file rename to Lib/test/test_importlib/resources/data01/binary.file diff --git a/Lib/test/test_importlib/data01/subdirectory/__init__.py b/Lib/test/test_importlib/resources/data01/subdirectory/__init__.py similarity index 100% rename from Lib/test/test_importlib/data01/subdirectory/__init__.py rename to Lib/test/test_importlib/resources/data01/subdirectory/__init__.py diff --git a/Lib/test/test_importlib/data01/subdirectory/binary.file b/Lib/test/test_importlib/resources/data01/subdirectory/binary.file similarity index 100% rename from Lib/test/test_importlib/data01/subdirectory/binary.file rename to Lib/test/test_importlib/resources/data01/subdirectory/binary.file diff --git a/Lib/test/test_importlib/data01/utf-16.file b/Lib/test/test_importlib/resources/data01/utf-16.file similarity index 100% rename from Lib/test/test_importlib/data01/utf-16.file rename to Lib/test/test_importlib/resources/data01/utf-16.file diff --git a/Lib/test/test_importlib/data01/utf-8.file b/Lib/test/test_importlib/resources/data01/utf-8.file similarity index 100% rename from Lib/test/test_importlib/data01/utf-8.file rename to Lib/test/test_importlib/resources/data01/utf-8.file diff --git a/Lib/test/test_importlib/data02/__init__.py b/Lib/test/test_importlib/resources/data02/__init__.py similarity index 100% rename from Lib/test/test_importlib/data02/__init__.py rename to Lib/test/test_importlib/resources/data02/__init__.py diff --git a/Lib/test/test_importlib/data02/one/__init__.py b/Lib/test/test_importlib/resources/data02/one/__init__.py similarity index 100% rename from Lib/test/test_importlib/data02/one/__init__.py rename to Lib/test/test_importlib/resources/data02/one/__init__.py diff --git a/Lib/test/test_importlib/data02/one/resource1.txt b/Lib/test/test_importlib/resources/data02/one/resource1.txt similarity index 100% rename from Lib/test/test_importlib/data02/one/resource1.txt rename to Lib/test/test_importlib/resources/data02/one/resource1.txt diff --git a/Lib/test/test_importlib/data02/two/__init__.py b/Lib/test/test_importlib/resources/data02/two/__init__.py similarity index 100% rename from Lib/test/test_importlib/data02/two/__init__.py rename to Lib/test/test_importlib/resources/data02/two/__init__.py diff --git a/Lib/test/test_importlib/data02/two/resource2.txt b/Lib/test/test_importlib/resources/data02/two/resource2.txt similarity index 100% rename from Lib/test/test_importlib/data02/two/resource2.txt rename to Lib/test/test_importlib/resources/data02/two/resource2.txt diff --git a/Lib/test/test_importlib/data03/__init__.py b/Lib/test/test_importlib/resources/data03/__init__.py similarity index 100% rename from Lib/test/test_importlib/data03/__init__.py rename to Lib/test/test_importlib/resources/data03/__init__.py diff --git a/Lib/test/test_importlib/data03/namespace/portion1/__init__.py b/Lib/test/test_importlib/resources/data03/namespace/portion1/__init__.py similarity index 100% rename from Lib/test/test_importlib/data03/namespace/portion1/__init__.py rename to Lib/test/test_importlib/resources/data03/namespace/portion1/__init__.py diff --git a/Lib/test/test_importlib/data03/namespace/portion2/__init__.py b/Lib/test/test_importlib/resources/data03/namespace/portion2/__init__.py similarity index 100% rename from Lib/test/test_importlib/data03/namespace/portion2/__init__.py rename to Lib/test/test_importlib/resources/data03/namespace/portion2/__init__.py diff --git a/Lib/test/test_importlib/data03/namespace/resource1.txt b/Lib/test/test_importlib/resources/data03/namespace/resource1.txt similarity index 100% rename from Lib/test/test_importlib/data03/namespace/resource1.txt rename to Lib/test/test_importlib/resources/data03/namespace/resource1.txt diff --git a/Lib/test/test_importlib/namespacedata01/binary.file b/Lib/test/test_importlib/resources/namespacedata01/binary.file similarity index 100% rename from Lib/test/test_importlib/namespacedata01/binary.file rename to Lib/test/test_importlib/resources/namespacedata01/binary.file diff --git a/Lib/test/test_importlib/namespacedata01/utf-16.file b/Lib/test/test_importlib/resources/namespacedata01/utf-16.file similarity index 100% rename from Lib/test/test_importlib/namespacedata01/utf-16.file rename to Lib/test/test_importlib/resources/namespacedata01/utf-16.file diff --git a/Lib/test/test_importlib/namespacedata01/utf-8.file b/Lib/test/test_importlib/resources/namespacedata01/utf-8.file similarity index 100% rename from Lib/test/test_importlib/namespacedata01/utf-8.file rename to Lib/test/test_importlib/resources/namespacedata01/utf-8.file diff --git a/Lib/test/test_importlib/test_compatibilty_files.py b/Lib/test/test_importlib/resources/test_compatibilty_files.py similarity index 99% rename from Lib/test/test_importlib/test_compatibilty_files.py rename to Lib/test/test_importlib/resources/test_compatibilty_files.py index 9a823f2d930..6fa18a24973 100644 --- a/Lib/test/test_importlib/test_compatibilty_files.py +++ b/Lib/test/test_importlib/resources/test_compatibilty_files.py @@ -8,7 +8,7 @@ from importlib.resources._adapters import ( wrap_spec, ) -from .resources import util +from . import util class CompatibilityFilesTests(unittest.TestCase): diff --git a/Lib/test/test_importlib/test_contents.py b/Lib/test/test_importlib/resources/test_contents.py similarity index 97% rename from Lib/test/test_importlib/test_contents.py rename to Lib/test/test_importlib/resources/test_contents.py index 3323bf5b5cf..1a13f043a86 100644 --- a/Lib/test/test_importlib/test_contents.py +++ b/Lib/test/test_importlib/resources/test_contents.py @@ -2,7 +2,7 @@ import unittest from importlib import resources from . import data01 -from .resources import util +from . import util class ContentsTests: diff --git a/Lib/test/test_importlib/test_files.py b/Lib/test/test_importlib/resources/test_files.py similarity index 97% rename from Lib/test/test_importlib/test_files.py rename to Lib/test/test_importlib/resources/test_files.py index b9170d83bea..4665ed7cc00 100644 --- a/Lib/test/test_importlib/test_files.py +++ b/Lib/test/test_importlib/resources/test_files.py @@ -4,7 +4,7 @@ import unittest from importlib import resources from importlib.abc import Traversable from . import data01 -from .resources import util +from . import util class FilesTests: diff --git a/Lib/test/test_importlib/test_open.py b/Lib/test/test_importlib/resources/test_open.py similarity index 98% rename from Lib/test/test_importlib/test_open.py rename to Lib/test/test_importlib/resources/test_open.py index df75e343d2c..0554c41ba67 100644 --- a/Lib/test/test_importlib/test_open.py +++ b/Lib/test/test_importlib/resources/test_open.py @@ -2,7 +2,7 @@ import unittest from importlib import resources from . import data01 -from .resources import util +from . import util class CommonBinaryTests(util.CommonTests, unittest.TestCase): diff --git a/Lib/test/test_importlib/test_path.py b/Lib/test/test_importlib/resources/test_path.py similarity index 98% rename from Lib/test/test_importlib/test_path.py rename to Lib/test/test_importlib/resources/test_path.py index 6fc41f301d1..adcf75feea7 100644 --- a/Lib/test/test_importlib/test_path.py +++ b/Lib/test/test_importlib/resources/test_path.py @@ -3,7 +3,7 @@ import unittest from importlib import resources from . import data01 -from .resources import util +from . import util class CommonTests(util.CommonTests, unittest.TestCase): diff --git a/Lib/test/test_importlib/test_read.py b/Lib/test/test_importlib/resources/test_read.py similarity index 98% rename from Lib/test/test_importlib/test_read.py rename to Lib/test/test_importlib/resources/test_read.py index ebd72267776..0ca8ee9d028 100644 --- a/Lib/test/test_importlib/test_read.py +++ b/Lib/test/test_importlib/resources/test_read.py @@ -2,7 +2,7 @@ import unittest from importlib import import_module, resources from . import data01 -from .resources import util +from . import util class CommonBinaryTests(util.CommonTests, unittest.TestCase): diff --git a/Lib/test/test_importlib/test_reader.py b/Lib/test/test_importlib/resources/test_reader.py similarity index 100% rename from Lib/test/test_importlib/test_reader.py rename to Lib/test/test_importlib/resources/test_reader.py diff --git a/Lib/test/test_importlib/test_resource.py b/Lib/test/test_importlib/resources/test_resource.py similarity index 99% rename from Lib/test/test_importlib/test_resource.py rename to Lib/test/test_importlib/resources/test_resource.py index 834b8bd8a28..1d6df0cc843 100644 --- a/Lib/test/test_importlib/test_resource.py +++ b/Lib/test/test_importlib/resources/test_resource.py @@ -5,7 +5,7 @@ import pathlib from . import data01 from . import zipdata01, zipdata02 -from .resources import util +from . import util from importlib import resources, import_module from test.support import import_helper from test.support.os_helper import unlink diff --git a/Lib/test/test_importlib/update-zips.py b/Lib/test/test_importlib/resources/update-zips.py similarity index 100% rename from Lib/test/test_importlib/update-zips.py rename to Lib/test/test_importlib/resources/update-zips.py diff --git a/Lib/test/test_importlib/resources/util.py b/Lib/test/test_importlib/resources/util.py index 11c8aa80806..f80c9cd01d6 100644 --- a/Lib/test/test_importlib/resources/util.py +++ b/Lib/test/test_importlib/resources/util.py @@ -5,8 +5,8 @@ import sys import types from pathlib import Path, PurePath -from .. import data01 -from .. import zipdata01 +from . import data01 +from . import zipdata01 from importlib.abc import ResourceReader from test.support import import_helper diff --git a/Lib/test/test_importlib/zipdata01/__init__.py b/Lib/test/test_importlib/resources/zipdata01/__init__.py similarity index 100% rename from Lib/test/test_importlib/zipdata01/__init__.py rename to Lib/test/test_importlib/resources/zipdata01/__init__.py diff --git a/Lib/test/test_importlib/zipdata01/ziptestdata.zip b/Lib/test/test_importlib/resources/zipdata01/ziptestdata.zip similarity index 100% rename from Lib/test/test_importlib/zipdata01/ziptestdata.zip rename to Lib/test/test_importlib/resources/zipdata01/ziptestdata.zip diff --git a/Lib/test/test_importlib/zipdata02/__init__.py b/Lib/test/test_importlib/resources/zipdata02/__init__.py similarity index 100% rename from Lib/test/test_importlib/zipdata02/__init__.py rename to Lib/test/test_importlib/resources/zipdata02/__init__.py diff --git a/Lib/test/test_importlib/zipdata02/ziptestdata.zip b/Lib/test/test_importlib/resources/zipdata02/ziptestdata.zip similarity index 100% rename from Lib/test/test_importlib/zipdata02/ziptestdata.zip rename to Lib/test/test_importlib/resources/zipdata02/ziptestdata.zip diff --git a/Makefile.pre.in b/Makefile.pre.in index dd0216572e6..ab44f2158e9 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1926,15 +1926,6 @@ TESTSUBDIRS= distutils/tests \ test/test_importlib \ test/test_importlib/builtin \ test/test_importlib/data \ - test/test_importlib/data01 \ - test/test_importlib/data01/subdirectory \ - test/test_importlib/data02 \ - test/test_importlib/data02/one \ - test/test_importlib/data02/two \ - test/test_importlib/data03 \ - test/test_importlib/data03/namespace \ - test/test_importlib/data03/namespace/portion1 \ - test/test_importlib/data03/namespace/portion2 \ test/test_importlib/extension \ test/test_importlib/frozen \ test/test_importlib/import_ \ @@ -1958,12 +1949,21 @@ TESTSUBDIRS= distutils/tests \ test/test_importlib/namespace_pkgs/project3 \ test/test_importlib/namespace_pkgs/project3/parent \ test/test_importlib/namespace_pkgs/project3/parent/child \ - test/test_importlib/namespacedata01 \ test/test_importlib/partial \ test/test_importlib/resources \ + test/test_importlib/resources/data01 \ + test/test_importlib/resources/data01/subdirectory \ + test/test_importlib/resources/data02 \ + test/test_importlib/resources/data02/one \ + test/test_importlib/resources/data02/two \ + test/test_importlib/resources/data03 \ + test/test_importlib/resources/data03/namespace \ + test/test_importlib/resources/data03/namespace/portion1 \ + test/test_importlib/resources/data03/namespace/portion2 \ + test/test_importlib/resources/namespacedata01 \ + test/test_importlib/resources/zipdata01 \ + test/test_importlib/resources/zipdata02 \ test/test_importlib/source \ - test/test_importlib/zipdata01 \ - test/test_importlib/zipdata02 \ test/test_json \ test/test_lib2to3 \ test/test_lib2to3/data \ diff --git a/Misc/NEWS.d/next/Tests/2022-07-24-17-24-42.gh-issue-95218.zfBLtu.rst b/Misc/NEWS.d/next/Tests/2022-07-24-17-24-42.gh-issue-95218.zfBLtu.rst new file mode 100644 index 00000000000..7326689657a --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-07-24-17-24-42.gh-issue-95218.zfBLtu.rst @@ -0,0 +1 @@ +Move tests for importlib.resources into test_importlib.resources.