Skip to content

Commit 6304bfd

Browse files
committed
Fixed template_coverage_collection initialisation. Tweaked a message. Updated coverage numbers.
- Legacy-Id: 12471
1 parent db7e554 commit 6304bfd

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

ietf/utils/test_runner.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
from django.core.urlresolvers import RegexURLResolver
6161

6262
import debug # pyflakes:ignore
63+
debug.debug = True
6364

6465
import ietf
6566
import ietf.utils.mail
@@ -397,7 +398,6 @@ def setup_test_environment(self, **kwargs):
397398
}
398399

399400
settings.TEMPLATES[0]['OPTIONS']['loaders'] = ('ietf.utils.test_runner.TemplateCoverageLoader',) + settings.TEMPLATES[0]['OPTIONS']['loaders']
400-
template_coverage_collection = True
401401

402402
settings.MIDDLEWARE_CLASSES = ('ietf.utils.test_runner.RecordUrlsMiddleware',) + settings.MIDDLEWARE_CLASSES
403403
url_coverage_collection = True
@@ -414,7 +414,7 @@ def setup_test_environment(self, **kwargs):
414414
settings.SITE_ID = 1
415415

416416
if settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] != '':
417-
print(" Changing settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] to '' during testing")
417+
print(" Changing TEMPLATES[0]['OPTIONS']['string_if_invalid'] to '' during testing")
418418
settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] = ''
419419

420420
assert not settings.IDTRACKER_BASE_URL.endswith('/')
@@ -490,14 +490,15 @@ def get_test_paths(self, test_labels):
490490
return test_apps, test_paths
491491

492492
def run_tests(self, test_labels, extra_tests=[], **kwargs):
493+
global old_destroy, old_create, test_database_name, template_coverage_collection
494+
from django.db import connection
495+
493496
# Tests that involve switching back and forth between the real
494497
# database and the test database are way too dangerous to run
495498
# against the production database
496499
if socket.gethostname().split('.')[0] in ['core3', 'ietfa', 'ietfb', 'ietfc', ]:
497500
raise EnvironmentError("Refusing to run tests on production server")
498501

499-
global old_destroy, old_create, test_database_name
500-
from django.db import connection
501502
old_create = connection.creation.__class__.create_test_db
502503
connection.creation.__class__.create_test_db = safe_create_1
503504
old_destroy = connection.creation.__class__.destroy_test_db
@@ -511,6 +512,7 @@ def run_tests(self, test_labels, extra_tests=[], **kwargs):
511512
self.test_apps, self.test_paths = self.get_test_paths(test_labels)
512513

513514
if self.check_coverage:
515+
template_coverage_collection = True
514516
extra_tests += [
515517
CoverageTest(test_runner=self, methodName='url_coverage_test'),
516518
CoverageTest(test_runner=self, methodName='template_coverage_test'),

release-coverage.json.gz

10.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)