diff --git a/Makefile b/Makefile
index 5f0d49278..fe42dd10b 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ test-figleaf:
$(PP) trial --reporter=bwverbose-figleaf $(TEST)
figleaf-output:
- $(PP) python misc/figleaf2html -d coverage-html -x src/allmydata/test/figleaf.excludes
+ $(PP) python misc/figleaf2html -d coverage-html -r `python ./builddir.py`
@echo "now point your browser at coverage-html/index.html"
# after doing test-figleaf and figleaf-output, point your browser at
# coverage-html/index.html
diff --git a/src/allmydata/util/figleaf_htmlizer.py b/src/allmydata/util/figleaf_htmlizer.py
index 63a7960db..0aac077e7 100644
--- a/src/allmydata/util/figleaf_htmlizer.py
+++ b/src/allmydata/util/figleaf_htmlizer.py
@@ -26,7 +26,7 @@ def read_exclude_patterns(f):
return exclude_patterns
-def report_as_html(coverage, directory, exclude_patterns=[], ):
+def report_as_html(coverage, directory, exclude_patterns=[], root=None):
### now, output.
keys = coverage.keys()
@@ -45,6 +45,16 @@ def report_as_html(coverage, directory, exclude_patterns=[], ):
if k.endswith('figleaf.py'):
continue
+ display_filename = k
+ if root:
+ if not k.startswith(root):
+ continue
+ display_filename = k[len(root):]
+ assert not display_filename.startswith("/")
+ assert display_filename.endswith(".py")
+ display_filename = display_filename[:-3] # trim .py
+ display_filename = display_filename.replace("/", ".")
+
if not k.startswith("/"):
continue
@@ -100,9 +110,9 @@ def report_as_html(coverage, directory, exclude_patterns=[], ):
pcnt = n_covered * 100. / n_lines
except ZeroDivisionError:
pcnt = 100
- info_dict[k] = (n_lines, n_covered, pcnt)
+ info_dict[k] = (n_lines, n_covered, pcnt, display_filename)
- html_outfile = make_html_filename(os.path.basename(k))
+ html_outfile = make_html_filename(display_filename)
html_outfp = open(os.path.join(directory, html_outfile), 'w')
html_outfp.write('source file: %s
\n' % (k,))
html_outfp.write('file stats: %d lines, %d executed: %.1f%% covered\n' % (n_lines, n_covered, pcnt))
@@ -141,10 +151,10 @@ def report_as_html(coverage, directory, exclude_patterns=[], ):
index_fp.write('
Filename | # lines | # covered | % covered |
---|---|---|---|
totals: | %d | %d | %.1f%% |
%s | %d | %d | %.1f |
%s | %d | %d | %.1f |