Skip to content

Commit e3a7d47

Browse files
committed
Moved some code and tweaked settings to ignore sql debug functions when calculating code coverage.
- Legacy-Id: 12069
1 parent 9e18351 commit e3a7d47

3 files changed

Lines changed: 2 additions & 35 deletions

File tree

ietf/doc/templatetags/ietf_filters.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@
2424
def collapsebr(html):
2525
return re.sub('(<(br ?/|/p)>[ \n]*)(<(br) ?/?>[ \n]*)*(<(br|p) ?/?>[ \n]*)', '\\1\\5', html)
2626

27-
@register.filter(name='expand_comma')
28-
def expand_comma(value):
29-
"""
30-
Adds a space after each comma, to allow word-wrapping of
31-
long comma-separated lists."""
32-
return value.replace(",", ", ")
33-
3427
@register.filter
3528
def indent(value, numspaces=2):
3629
replacement = "\n" + " " * int(numspaces)
@@ -119,15 +112,6 @@ def make_one_per_line(value):
119112
else:
120113
return value
121114

122-
@register.filter(name='timesum')
123-
def timesum(value):
124-
"""
125-
Sum the times in a list of dicts; used for sql query debugging info"""
126-
sum = 0.0
127-
for v in value:
128-
sum += float(v['time'])
129-
return sum
130-
131115
@register.filter(name='keep_spacing')
132116
def keep_spacing(value):
133117
"""
@@ -632,21 +616,3 @@ def comma_separated_list(seq, end_word="and"):
632616
def role_names(roles):
633617
return list(set([ "%s %s" % (r.group.name, r.name.name) for r in roles ]))
634618

635-
@register.filter()
636-
def annotate_sql_queries(queries):
637-
counts = {}
638-
timeacc = {}
639-
for q in queries:
640-
sql = q['sql']
641-
if not sql in counts:
642-
counts[sql] = 0;
643-
counts[sql] += 1
644-
if not sql in timeacc:
645-
timeacc[sql] = 0.0;
646-
timeacc[sql] += float(q['time'])
647-
for q in queries:
648-
sql = q['sql']
649-
q['count'] = str(counts[sql])
650-
q['time_accum'] = "%4.3f" % timeacc[sql]
651-
return queries
652-

ietf/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ def skip_unreadable_post(record):
391391
"ietf/settings*",
392392
"ietf/utils/test_runner.py",
393393
"ietf/checks.py",
394+
"ietf/utils/templatetags/debug_filters.py",
394395
]
395396

396397
TEST_COVERAGE_MASTER_FILE = os.path.join(BASE_DIR, "../release-coverage.json.gz")

ietf/templates/debug.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{# Copyright The IETF Trust 2015, All Rights Reserved #}
22
{% load origin %}{% origin %}
33
{% if debug %}
4-
{% load ietf_filters %}
4+
{% load debug_filters %}
55
{% load future %}
66

77
<div id="debug">

0 commit comments

Comments
 (0)