@@ -72,8 +72,12 @@ def test_settings():
72
72
class DjangoPluginTestCase (TempDirMixin , TestCase ):
73
73
"""A base class for all our tests."""
74
74
75
- def path (self , name = None ):
76
- return "templates/{}" .format (name or self .template_file )
75
+ def setUp (self ):
76
+ super (DjangoPluginTestCase , self ).setUp ()
77
+ self .template_directory = "templates"
78
+
79
+ def _path (self , name = None ):
80
+ return "{}/{}" .format (self .template_directory , name or self .template_file )
77
81
78
82
def make_template (self , text , name = None ):
79
83
"""Make a template with `text`.
@@ -86,7 +90,7 @@ def make_template(self, text, name=None):
86
90
self .template_file = name
87
91
else :
88
92
self .template_file = self .id ().rpartition ("." )[2 ] + ".html"
89
- template_path = self .path (self .template_file )
93
+ template_path = self ._path (self .template_file )
90
94
return os .path .abspath (self .make_file (template_path , text ))
91
95
92
96
def run_django_coverage (
@@ -144,7 +148,7 @@ def get_line_data(self, name=None):
144
148
list: the line numbers of lines executed in the template.
145
149
146
150
"""
147
- path = self .path (name )
151
+ path = self ._path (name )
148
152
line_data = self .cov .data .line_data ()[os .path .realpath (path )]
149
153
return line_data
150
154
@@ -156,7 +160,7 @@ def get_analysis(self, name=None):
156
160
numbers of missed lines.
157
161
158
162
"""
159
- path = self .path (name )
163
+ path = self ._path (name )
160
164
analysis = self .cov .analysis2 (os .path .abspath (path ))
161
165
_ , executable , _ , missing , _ = analysis
162
166
return executable , missing
@@ -190,7 +194,7 @@ def get_html_report(self, name=None):
190
194
float: the total percentage covered.
191
195
192
196
"""
193
- path = self .path (name )
197
+ path = self ._path (name )
194
198
html_coverage = self .cov .html_report (os .path .abspath (path ))
195
199
return html_coverage
196
200
@@ -201,7 +205,7 @@ def get_xml_report(self, name=None):
201
205
float: the total percentage covered.
202
206
203
207
"""
204
- path = self .path (name )
208
+ path = self ._path (name )
205
209
xml_coverage = self .cov .xml_report (os .path .abspath (path ))
206
210
return xml_coverage
207
211
0 commit comments