summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_main.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2020-10-19 21:14:21 (GMT)
committerGitHub <noreply@github.com>2020-10-19 21:14:21 (GMT)
commit96ddc58281d2b6b2258b1a628bccf252090d5611 (patch)
tree7147b420c790abefc96072a9ec311ffe9cddc509 /Lib/test/test_importlib/test_main.py
parent95ad890a7b0341d8d2fde13f824bc24c65a8ece0 (diff)
downloadcpython-96ddc58281d2b6b2258b1a628bccf252090d5611.zip
cpython-96ddc58281d2b6b2258b1a628bccf252090d5611.tar.gz
cpython-96ddc58281d2b6b2258b1a628bccf252090d5611.tar.bz2
bpo-42089: Sync with current cpython branch of importlib_metadata (GH-22775)
~~The only differences are in the test files.~~ Automerge-Triggered-By: @jaraco
Diffstat (limited to 'Lib/test/test_importlib/test_main.py')
-rw-r--r--Lib/test/test_importlib/test_main.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py
index 91e501a..a26bab6 100644
--- a/Lib/test/test_importlib/test_main.py
+++ b/Lib/test/test_importlib/test_main.py
@@ -32,6 +32,18 @@ class BasicTests(fixtures.DistInfoPkg, unittest.TestCase):
with self.assertRaises(PackageNotFoundError):
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.
+ """
+ with self.assertRaises(PackageNotFoundError) as ctx:
+ Distribution.from_name('does-not-exist')
+
+ assert "metadata" in str(ctx.exception)
+
def test_new_style_classes(self):
self.assertIsInstance(Distribution, type)