Skip to content

Commit

Permalink
PythonFileReporter: add .jinja* to filename extensions expected t…
Browse files Browse the repository at this point in the history
…o be evaluated using Python code.
  • Loading branch information
jayaddison committed May 9, 2024
1 parent c94a0d5 commit 69e6ef0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions coverage/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def should_be_python(self) -> bool:
# Anything named *.py* should be Python.
if ext.startswith(".py"):
return True
# Jinja templates are evaluated using Python.
if ext.startswith('.jinja'):
return True
# Everything else is probably not Python.
return False

Expand Down
2 changes: 2 additions & 0 deletions tests/test_filereporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def test_zipfile(self) -> None:
def test_python_extensions(self):
f1 = PythonFileReporter("afile.py")
f2 = PythonFileReporter("Makefile")
f3 = PythonFileReporter("template.jinja")

assert f1.should_be_python()
assert not f2.should_be_python()
assert f3.should_be_python()

0 comments on commit 69e6ef0

Please sign in to comment.