Skip to content

Commit 5d1bdde

Browse files
committed
Added control by the --verbosity switch of the not loaded template test and not tested urls test, so they only will be run for verbosity greater than 1.
- Legacy-Id: 7244
2 parents c52d7c0 + ba6d31f commit 5d1bdde

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

ietf/utils/test_runner.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
from django.test.runner import DiscoverRunner
4141
from django.core.management import call_command
4242

43-
import debug
44-
4543
import ietf.utils.mail
4644

4745
loaded_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

Comments
 (0)