From fd37b8ebb7c83207a3af6ebcf28c23090e65ed64 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 3 Nov 2024 20:38:15 +0100 Subject: [PATCH] Handle missing configuration items in dictionary. --- doc/requirements.txt | 1 + sphinx_reports/Unittest.py | 5 ++++- sphinx_reports/__init__.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index c7b347d7..c1eaf531 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -3,6 +3,7 @@ # Enforce latest version on ReadTheDocs sphinx ~= 8.1 docutils ~= 0.21 +docutils_stubs ~= 0.0.22 # ReadTheDocs Theme sphinx_rtd_theme ~= 3.0.1 diff --git a/sphinx_reports/Unittest.py b/sphinx_reports/Unittest.py index 283bcf55..2ba4dc8b 100644 --- a/sphinx_reports/Unittest.py +++ b/sphinx_reports/Unittest.py @@ -85,7 +85,10 @@ def _CheckOptions(self) -> None: self._reportID = self._ParseStringOption("reportid") self._noAssertions = "without-assertions" in self.options - testSummary = self._testSummaries[self._reportID] + try: + testSummary = self._testSummaries[self._reportID] + except KeyError as ex: + raise ReportExtensionError(f"No unit testing configuration item for '{self._reportID}'.") from ex self._xmlReport = testSummary["xml_report"] @classmethod diff --git a/sphinx_reports/__init__.py b/sphinx_reports/__init__.py index 94f3d5de..25c22821 100644 --- a/sphinx_reports/__init__.py +++ b/sphinx_reports/__init__.py @@ -43,7 +43,7 @@ __email__ = "Paebbels@gmail.com" __copyright__ = "2023-2024, Patrick Lehmann" __license__ = "Apache License, Version 2.0" -__version__ = "0.7.3" +__version__ = "0.7.4" __keywords__ = ["Python3", "Sphinx", "Extension", "Report", "doc-string", "interrogate"] from hashlib import md5