diff options
author | Brett Cannon <brett@python.org> | 2021-04-02 12:35:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-02 12:35:32 -0700 |
commit | f97dc800689ba98783dac8dc51f87f7c6f413ac6 (patch) | |
tree | e51ae8f2bf8b3f5434ab4d8b37cd0eef87b62c4e /Lib/test/test_importlib/test_main.py | |
parent | ad442a674ca443feec43a88a2d3671784712e550 (diff) | |
download | cpython-git-f97dc800689ba98783dac8dc51f87f7c6f413ac6.tar.gz |
bpo-43672: raise ImportWarning when calling find_loader() (GH-25119)
Diffstat (limited to 'Lib/test/test_importlib/test_main.py')
-rw-r--r-- | Lib/test/test_importlib/test_main.py | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py index 02e8a57343..db97e53922 100644 --- a/Lib/test/test_importlib/test_main.py +++ b/Lib/test/test_importlib/test_main.py @@ -36,12 +36,10 @@ class BasicTests(fixtures.DistInfoPkg, unittest.TestCase): Distribution.from_name('does-not-exist') def test_package_not_found_mentions_metadata(self): - """ - When a package is not found, that could indicate that the - packgae is not installed or that it is installed without - metadata. Ensure the exception mentions metadata to help - guide users toward the cause. See #124. - """ + # When a package is not found, that could indicate that the + # packgae is not installed or that it is installed without + # metadata. Ensure the exception mentions metadata to help + # guide users toward the cause. See #124. with self.assertRaises(PackageNotFoundError) as ctx: Distribution.from_name('does-not-exist') @@ -90,10 +88,8 @@ class NameNormalizationTests(fixtures.OnSysPath, fixtures.SiteDir, unittest.Test return 'my-pkg' def test_dashes_in_dist_name_found_as_underscores(self): - """ - For a package with a dash in the name, the dist-info metadata - uses underscores in the name. Ensure the metadata loads. - """ + # For a package with a dash in the name, the dist-info metadata + # uses underscores in the name. Ensure the metadata loads. pkg_name = self.pkg_with_dashes(self.site_dir) assert version(pkg_name) == '1.0' @@ -111,9 +107,7 @@ class NameNormalizationTests(fixtures.OnSysPath, fixtures.SiteDir, unittest.Test return 'CherryPy' def test_dist_name_found_as_any_case(self): - """ - Ensure the metadata loads when queried with any case. - """ + # Ensure the metadata loads when queried with any case. pkg_name = self.pkg_with_mixed_case(self.site_dir) assert version(pkg_name) == '1.0' assert version(pkg_name.lower()) == '1.0' @@ -241,13 +235,11 @@ class TestEntryPoints(unittest.TestCase): assert "'name'" in repr(self.ep) def test_hashable(self): - """EntryPoints should be hashable""" + # EntryPoints should be hashable. hash(self.ep) def test_json_dump(self): - """ - json should not expect to be able to dump an EntryPoint - """ + # json should not expect to be able to dump an EntryPoint. with self.assertRaises(Exception): with warnings.catch_warnings(record=True): json.dumps(self.ep) @@ -259,9 +251,7 @@ class TestEntryPoints(unittest.TestCase): assert self.ep.attr is None def test_sortable(self): - """ - EntryPoint objects are sortable, but result is undefined. - """ + # EntryPoint objects are sortable, but result is undefined. sorted( [ EntryPoint('b', 'val', 'group'), @@ -274,10 +264,8 @@ class FileSystem( fixtures.OnSysPath, fixtures.SiteDir, fixtures.FileBuilder, unittest.TestCase ): def test_unicode_dir_on_sys_path(self): - """ - Ensure a Unicode subdirectory of a directory on sys.path - does not crash. - """ + # Ensure a Unicode subdirectory of a directory on sys.path + # does not crash. fixtures.build_files( {self.unicode_filename(): {}}, prefix=self.site_dir, |