summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-01-22 13:54:20 -0500
committerJason R. Coombs <jaraco@jaraco.com>2022-01-22 14:05:15 -0500
commit1e0419fe85f850bce2ba7e4ad475fea839893f28 (patch)
treeb54e6bd8f6fe0a0658a9da4ad099afdafa0c9cf7
parenta941e5927f7f2540946813606c61c6aea38db426 (diff)
downloadcpython-git-bpo-46425/restore-simple-importlib-tests.tar.gz
bpo-46425: Partially revert "bpo-46425: fix direct invocation of `test_importlib` (GH-30682)"bpo-46425/restore-simple-importlib-tests
This reverts commit 57316c52bae5d6420f5067f3891ec328deb97305 for files pertaining to importlib.metadata and importlib.resources.
-rw-r--r--Lib/test/test_importlib/test_compatibilty_files.py6
-rw-r--r--Lib/test/test_importlib/test_contents.py10
-rw-r--r--Lib/test/test_importlib/test_files.py6
-rw-r--r--Lib/test/test_importlib/test_main.py8
-rw-r--r--Lib/test/test_importlib/test_metadata_api.py6
-rw-r--r--Lib/test/test_importlib/test_open.py6
-rw-r--r--Lib/test/test_importlib/test_path.py4
-rw-r--r--Lib/test/test_importlib/test_read.py6
-rw-r--r--Lib/test/test_importlib/test_resource.py5
-rw-r--r--Lib/test/test_importlib/test_zip.py5
10 files changed, 22 insertions, 40 deletions
diff --git a/Lib/test/test_importlib/test_compatibilty_files.py b/Lib/test/test_importlib/test_compatibilty_files.py
index 18cbdee6ce..9a823f2d93 100644
--- a/Lib/test/test_importlib/test_compatibilty_files.py
+++ b/Lib/test/test_importlib/test_compatibilty_files.py
@@ -8,7 +8,7 @@ from importlib.resources._adapters import (
wrap_spec,
)
-from test.test_importlib.resources import util
+from .resources import util
class CompatibilityFilesTests(unittest.TestCase):
@@ -100,7 +100,3 @@ class CompatibilityFilesNoReaderTests(unittest.TestCase):
def test_spec_path_joinpath(self):
self.assertIsInstance(self.files / 'a', CompatibilityFiles.OrphanPath)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/Lib/test/test_importlib/test_contents.py b/Lib/test/test_importlib/test_contents.py
index a5b6538a2f..3323bf5b5c 100644
--- a/Lib/test/test_importlib/test_contents.py
+++ b/Lib/test/test_importlib/test_contents.py
@@ -1,8 +1,8 @@
import unittest
from importlib import resources
-from test.test_importlib import data01
-from test.test_importlib.resources import util
+from . import data01
+from .resources import util
class ContentsTests:
@@ -38,10 +38,6 @@ class ContentsNamespaceTests(ContentsTests, unittest.TestCase):
}
def setUp(self):
- from test.test_importlib import namespacedata01
+ from . import namespacedata01
self.data = namespacedata01
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/Lib/test/test_importlib/test_files.py b/Lib/test/test_importlib/test_files.py
index 3f28b55509..b9170d83be 100644
--- a/Lib/test/test_importlib/test_files.py
+++ b/Lib/test/test_importlib/test_files.py
@@ -3,8 +3,8 @@ import unittest
from importlib import resources
from importlib.abc import Traversable
-from test.test_importlib import data01
-from test.test_importlib.resources import util
+from . import data01
+from .resources import util
class FilesTests:
@@ -37,7 +37,7 @@ class OpenZipTests(FilesTests, util.ZipSetup, unittest.TestCase):
class OpenNamespaceTests(FilesTests, unittest.TestCase):
def setUp(self):
- from test.test_importlib import namespacedata01
+ from . import namespacedata01
self.data = namespacedata01
diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py
index 77e3dd7e08..2e120f7ac5 100644
--- a/Lib/test/test_importlib/test_main.py
+++ b/Lib/test/test_importlib/test_main.py
@@ -9,9 +9,9 @@ import importlib.metadata
try:
import pyfakefs.fake_filesystem_unittest as ffs
except ImportError:
- from test.test_importlib.stubs import fake_filesystem_unittest as ffs
+ from .stubs import fake_filesystem_unittest as ffs
-from test.test_importlib import fixtures
+from . import fixtures
from importlib.metadata import (
Distribution,
EntryPoint,
@@ -315,7 +315,3 @@ class PackagesDistributionsTest(
prefix=self.site_dir,
)
packages_distributions()
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/Lib/test/test_importlib/test_metadata_api.py b/Lib/test/test_importlib/test_metadata_api.py
index 24d46c3d28..e16773a7e8 100644
--- a/Lib/test/test_importlib/test_metadata_api.py
+++ b/Lib/test/test_importlib/test_metadata_api.py
@@ -5,7 +5,7 @@ import warnings
import importlib
import contextlib
-from test.test_importlib import fixtures
+from . import fixtures
from importlib.metadata import (
Distribution,
PackageNotFoundError,
@@ -313,7 +313,3 @@ class InvalidateCache(unittest.TestCase):
def test_invalidate_cache(self):
# No externally observable behavior, but ensures test coverage...
importlib.invalidate_caches()
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/Lib/test/test_importlib/test_open.py b/Lib/test/test_importlib/test_open.py
index ab390269e0..df75e343d2 100644
--- a/Lib/test/test_importlib/test_open.py
+++ b/Lib/test/test_importlib/test_open.py
@@ -1,8 +1,8 @@
import unittest
from importlib import resources
-from test.test_importlib import data01
-from test.test_importlib.resources import util
+from . import data01
+from .resources import util
class CommonBinaryTests(util.CommonTests, unittest.TestCase):
@@ -68,7 +68,7 @@ class OpenDiskTests(OpenTests, unittest.TestCase):
class OpenDiskNamespaceTests(OpenTests, unittest.TestCase):
def setUp(self):
- from test.test_importlib import namespacedata01
+ from . import namespacedata01
self.data = namespacedata01
diff --git a/Lib/test/test_importlib/test_path.py b/Lib/test/test_importlib/test_path.py
index 66dc0b215a..6fc41f301d 100644
--- a/Lib/test/test_importlib/test_path.py
+++ b/Lib/test/test_importlib/test_path.py
@@ -2,8 +2,8 @@ import io
import unittest
from importlib import resources
-from test.test_importlib import data01
-from test.test_importlib.resources import util
+from . import data01
+from .resources import util
class CommonTests(util.CommonTests, unittest.TestCase):
diff --git a/Lib/test/test_importlib/test_read.py b/Lib/test/test_importlib/test_read.py
index 7e907e4c8c..ebd7226777 100644
--- a/Lib/test/test_importlib/test_read.py
+++ b/Lib/test/test_importlib/test_read.py
@@ -1,8 +1,8 @@
import unittest
from importlib import import_module, resources
-from test.test_importlib import data01
-from test.test_importlib.resources import util
+from . import data01
+from .resources import util
class CommonBinaryTests(util.CommonTests, unittest.TestCase):
@@ -66,7 +66,7 @@ class ReadZipTests(ReadTests, util.ZipSetup, unittest.TestCase):
class ReadNamespaceTests(ReadTests, unittest.TestCase):
def setUp(self):
- from test.test_importlib import namespacedata01
+ from . import namespacedata01
self.data = namespacedata01
diff --git a/Lib/test/test_importlib/test_resource.py b/Lib/test/test_importlib/test_resource.py
index 825d1b0eb0..834b8bd8a2 100644
--- a/Lib/test/test_importlib/test_resource.py
+++ b/Lib/test/test_importlib/test_resource.py
@@ -3,8 +3,9 @@ import unittest
import uuid
import pathlib
-from test.test_importlib import data01, zipdata01, zipdata02
-from test.test_importlib.resources import util
+from . import data01
+from . import zipdata01, zipdata02
+from .resources 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/test_zip.py b/Lib/test/test_importlib/test_zip.py
index a9f5c68ac6..276f6288c9 100644
--- a/Lib/test/test_importlib/test_zip.py
+++ b/Lib/test/test_importlib/test_zip.py
@@ -1,7 +1,7 @@
import sys
import unittest
-from test.test_importlib import fixtures
+from . import fixtures
from importlib.metadata import (
PackageNotFoundError,
distribution,
@@ -60,6 +60,3 @@ class TestEgg(TestZip):
def test_normalized_name(self):
dist = distribution('example')
assert dist._normalized_name == 'example'
-
-if __name__ == '__main__':
- unittest.main()