@@ -72,8 +72,12 @@ def test_settings():
7272class DjangoPluginTestCase (TempDirMixin , TestCase ):
7373 """A base class for all our tests."""
7474
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 )
7781
7882 def make_template (self , text , name = None ):
7983 """Make a template with `text`.
@@ -86,7 +90,7 @@ def make_template(self, text, name=None):
8690 self .template_file = name
8791 else :
8892 self .template_file = self .id ().rpartition ("." )[2 ] + ".html"
89- template_path = self .path (self .template_file )
93+ template_path = self ._path (self .template_file )
9094 return os .path .abspath (self .make_file (template_path , text ))
9195
9296 def run_django_coverage (
@@ -144,7 +148,7 @@ def get_line_data(self, name=None):
144148 list: the line numbers of lines executed in the template.
145149
146150 """
147- path = self .path (name )
151+ path = self ._path (name )
148152 line_data = self .cov .data .line_data ()[os .path .realpath (path )]
149153 return line_data
150154
@@ -156,7 +160,7 @@ def get_analysis(self, name=None):
156160 numbers of missed lines.
157161
158162 """
159- path = self .path (name )
163+ path = self ._path (name )
160164 analysis = self .cov .analysis2 (os .path .abspath (path ))
161165 _ , executable , _ , missing , _ = analysis
162166 return executable , missing
@@ -190,7 +194,7 @@ def get_html_report(self, name=None):
190194 float: the total percentage covered.
191195
192196 """
193- path = self .path (name )
197+ path = self ._path (name )
194198 html_coverage = self .cov .html_report (os .path .abspath (path ))
195199 return html_coverage
196200
@@ -201,7 +205,7 @@ def get_xml_report(self, name=None):
201205 float: the total percentage covered.
202206
203207 """
204- path = self .path (name )
208+ path = self ._path (name )
205209 xml_coverage = self .cov .xml_report (os .path .abspath (path ))
206210 return xml_coverage
207211
0 commit comments