Skip to content

Commit d287548

Browse files
committed
fix: compare filenames with platform-appropriate case sensitivity
Fixes issue #46.
1 parent 2873549 commit d287548

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

HISTORY.rst

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ Unreleased
77

88
Drop support for Python 3.4 and 3.5.
99

10+
Fixed an issue on Windows where file names were being compared
11+
case-sensitively, causing templates to be missed (`issue 46`_).
12+
13+
.. _issue 46: https://github.com/nedbat/django_coverage_plugin/issues/46
1014

1115
v1.8.0 --- 2020-01-23
1216
---------------------

django_coverage_plugin/plugin.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ class DjangoTemplatePlugin(
156156
def __init__(self):
157157
self.debug_checked = False
158158

159-
self.django_template_dir = os.path.realpath(
159+
self.django_template_dir = os.path.normcase(os.path.realpath(
160160
os.path.dirname(django.template.__file__)
161-
)
161+
))
162162

163163
self.source_map = {}
164164

@@ -175,7 +175,7 @@ def sys_info(self):
175175
]
176176

177177
def file_tracer(self, filename):
178-
if filename.startswith(self.django_template_dir):
178+
if os.path.normcase(filename).startswith(self.django_template_dir):
179179
if not self.debug_checked:
180180
# Keep calling check_debug until it returns True, which it
181181
# will only do after settings have been configured

0 commit comments

Comments
 (0)