diff --git a/Lib/test/test_importlib/test_compatibilty_files.py b/Lib/test/test_importlib/test_compatibilty_files.py index 18cbdee6ce4756..a74cfea87c233a 100644 --- a/Lib/test/test_importlib/test_compatibilty_files.py +++ b/Lib/test/test_importlib/test_compatibilty_files.py @@ -8,7 +8,7 @@ wrap_spec, ) -from test.test_importlib.resources import util +from . import util class CompatibilityFilesTests(unittest.TestCase): @@ -102,5 +102,5 @@ def test_spec_path_joinpath(self): self.assertIsInstance(self.files / 'a', CompatibilityFiles.OrphanPath) -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_contents.py b/Lib/test/test_importlib/test_contents.py index a5b6538a2fc794..148939e86a8be6 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,10 @@ 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() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_files.py b/Lib/test/test_importlib/test_files.py index 3f28b55509bc11..e9ff02d58cdad4 100644 --- a/Lib/test/test_importlib/test_files.py +++ b/Lib/test/test_importlib/test_files.py @@ -3,8 +3,8 @@ 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,10 +37,10 @@ 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 -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py index 77e3dd7e084726..907ab8d496fa6b 100644 --- a/Lib/test/test_importlib/test_main.py +++ b/Lib/test/test_importlib/test_main.py @@ -9,9 +9,9 @@ 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, @@ -317,5 +317,5 @@ def test_packages_distributions_neither_toplevel_nor_files(self): packages_distributions() -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_metadata_api.py b/Lib/test/test_importlib/test_metadata_api.py index 24d46c3d280137..6503da2b17d984 100644 --- a/Lib/test/test_importlib/test_metadata_api.py +++ b/Lib/test/test_importlib/test_metadata_api.py @@ -5,7 +5,7 @@ import importlib import contextlib -from test.test_importlib import fixtures +from . import fixtures from importlib.metadata import ( Distribution, PackageNotFoundError, @@ -315,5 +315,5 @@ def test_invalidate_cache(self): importlib.invalidate_caches() -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_open.py b/Lib/test/test_importlib/test_open.py index ab390269e08f22..73a2a7a8267d5a 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 @@ def setUp(self): class OpenDiskNamespaceTests(OpenTests, unittest.TestCase): def setUp(self): - from test.test_importlib import namespacedata01 + from . import namespacedata01 self.data = namespacedata01 @@ -77,5 +77,5 @@ class OpenZipTests(OpenTests, util.ZipSetup, unittest.TestCase): pass -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_path.py b/Lib/test/test_importlib/test_path.py index 66dc0b215ad9fb..d0274732df7f4c 100644 --- a/Lib/test/test_importlib/test_path.py +++ b/Lib/test/test_importlib/test_path.py @@ -2,8 +2,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 CommonTests(util.CommonTests, unittest.TestCase): @@ -58,5 +58,5 @@ def test_remove_in_context_manager(self): path.unlink() -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_read.py b/Lib/test/test_importlib/test_read.py index 7e907e4c8c59ca..8fafefd4adf066 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,10 +66,10 @@ def test_read_submodule_resource_by_name(self): class ReadNamespaceTests(ReadTests, unittest.TestCase): def setUp(self): - from test.test_importlib import namespacedata01 + from . import namespacedata01 self.data = namespacedata01 -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_resource.py b/Lib/test/test_importlib/test_resource.py index 825d1b0eb054e9..02ea17286dfab4 100644 --- a/Lib/test/test_importlib/test_resource.py +++ b/Lib/test/test_importlib/test_resource.py @@ -3,8 +3,9 @@ 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 @@ -247,5 +248,5 @@ def test_submodule_contents_by_name(self): self.assertEqual(contents, {'binary.file', 'utf-8.file', 'utf-16.file'}) -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool. diff --git a/Lib/test/test_importlib/test_zip.py b/Lib/test/test_importlib/test_zip.py index a9f5c68ac60d72..0540099bd03dfd 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, @@ -61,5 +61,5 @@ def test_normalized_name(self): dist = distribution('example') assert dist._normalized_name == 'example' -if __name__ == '__main__': - unittest.main() +# This module is not suitable to be executed directly. +# Use appropriate test tool.