From e5d0c4ecdde1d1af958c981c6da87999bbdabe16 Mon Sep 17 00:00:00 2001 From: kosayoda Date: Fri, 14 May 2021 15:45:45 +0800 Subject: Fix misleading coverage report. Due to an optimization in CPython that is amended in 3.10, coverage.py is sometimes unable to determine the coverage of continue statements in branches. See: https://github.com/nedbat/coveragepy/issues/198 Adding a no-op like a print or an empty statement would solve the coverage issue, but I've opted to just ignore the line. This should be tested and the line removed when the site is updated to Python 3.10. --- pydis_site/apps/content/views/page_category.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pydis_site/apps/content') diff --git a/pydis_site/apps/content/views/page_category.py b/pydis_site/apps/content/views/page_category.py index 7427ec58..5af77aff 100644 --- a/pydis_site/apps/content/views/page_category.py +++ b/pydis_site/apps/content/views/page_category.py @@ -57,7 +57,9 @@ class PageOrCategoryView(TemplateView): entry_info["name"] = frontmatter.load(entry).metadata["title"] elif entry.is_dir(): entry_info["name"] = utils.get_category(entry)["title"] - else: + else: # pragma: no cover + # TODO: Remove coverage.py pragma in Python 3.10 + # See: https://github.com/nedbat/coveragepy/issues/198 continue context["subarticles"].append(entry_info) -- cgit v1.2.3