Skip to content

Commit

Permalink
Fix misleading coverage report.
Browse files Browse the repository at this point in the history
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: nedbat/coveragepy#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.
  • Loading branch information
kosayoda committed May 14, 2021
1 parent ba9fe3f commit e5d0c4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pydis_site/apps/content/views/page_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def get_context_data(self, **kwargs) -> t.Dict[str, t.Any]:
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)

Expand Down

0 comments on commit e5d0c4e

Please sign in to comment.