aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar kosayoda <[email protected]>2021-05-14 15:45:45 +0800
committerGravatar kosayoda <[email protected]>2021-05-14 15:45:45 +0800
commite5d0c4ecdde1d1af958c981c6da87999bbdabe16 (patch)
treecde38db4218ee29972b86414d7ee9cf4a8b40f13
parentMerge branch 'main' into dewikification (diff)
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.
-rw-r--r--pydis_site/apps/content/views/page_category.py4
1 files changed, 3 insertions, 1 deletions
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)