4040from django .test .runner import DiscoverRunner
4141from django .core .management import call_command
4242
43- import debug
44-
4543import ietf .utils .mail
4644
4745loaded_templates = set ()
@@ -111,7 +109,7 @@ def get_url_patterns(module):
111109 res .append ((item .regex .pattern + ".*" + sub , subitem ))
112110 return res
113111
114- def check_url_coverage ():
112+ def check_url_coverage (verbosity ):
115113 import ietf .urls
116114
117115 url_patterns = get_url_patterns (ietf .urls )
@@ -137,7 +135,7 @@ def ignore_pattern(regex, pattern):
137135
138136 missing = list (set (regex for regex , compiled in patterns ) - covered )
139137
140- if missing :
138+ if missing and verbosity > 1 :
141139 print "The following URL patterns were not tested"
142140 for pattern in sorted (missing ):
143141 print " Not tested" , pattern
@@ -159,11 +157,11 @@ def get_templates():
159157 templates .add (os .path .join (relative_path , file ))
160158 return templates
161159
162- def check_template_coverage ():
160+ def check_template_coverage (verbosity ):
163161 all_templates = get_templates ()
164162
165163 not_loaded = list (all_templates - loaded_templates )
166- if not_loaded :
164+ if not_loaded and verbosity > 1 :
167165 print "The following templates were never loaded during test"
168166 for t in sorted (not_loaded ):
169167 print " Not loaded" , t
@@ -224,8 +222,8 @@ def run_tests(self, test_labels, extra_tests=None, **kwargs):
224222 failures = super (IetfTestRunner , self ).run_tests (test_labels , extra_tests = extra_tests , ** kwargs )
225223
226224 if check_coverage and not failures :
227- check_template_coverage ()
228- check_url_coverage ()
225+ check_template_coverage (self . verbosity )
226+ check_url_coverage (self . verbosity )
229227
230228 print "0 test failures - coverage shown above"
231229
0 commit comments