From f2e9c39bb2d91ed57e92d55e82feb70daade6b2a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 17 Dec 2022 17:22:14 -0500 Subject: [PATCH] Add test capturing that a missing key raises a KeyError. Ref #371. --- tests/test_api.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_api.py b/tests/test_api.py index f65287a5..a9c1f194 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -141,6 +141,15 @@ def test_importlib_metadata_version(self): resolved = version('importlib-metadata') assert re.match(self.version_pattern, resolved) + @__import__('pytest').mark.xfail(reason="not implemented #371") + def test_missing_key(self): + """ + Attempting to request missing metadata raises KeyError. + """ + md = metadata('distinfo-pkg') + with self.assertRaises(KeyError): + md['does-not-exist'] + @staticmethod def _test_files(files): root = files[0].root