From 5cb1e9991cdcfec0b0720512727352f95c1996a5 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 11 May 2023 08:38:34 -0400 Subject: temp: show information about the lcov file failing. #1553 --- coverage/lcovreport.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/coverage/lcovreport.py b/coverage/lcovreport.py index b9fe2568..37e03b05 100644 --- a/coverage/lcovreport.py +++ b/coverage/lcovreport.py @@ -68,7 +68,15 @@ class LcovReporter: # characters of the encoding ("==") are removed from the hash to # allow genhtml to run on the resulting lcov file. if source_lines: - line = source_lines[covered-1].encode("utf-8") + try: + line = source_lines[covered-1].encode("utf-8") + except: + print(f"Failure processing {fr.filename!r}:") + with open(fr.filename) as f: + print("=" * 80) + print(f.read()) + print("=" * 80) + raise else: line = b"" hashed = base64.b64encode(md5(line).digest()).decode().rstrip("=") -- cgit v1.2.1