1. Mikhail Korobov
  2. django-coverage


Randall Degges  committed 70f5272

Adding new settings, ``COVERAGE_USE_STDOUT``.

This new config option (which defaults to ``True``), determines whether or not
running tests (using django-coverage's test runner) will output the coverage
report to STDOUT.

This allows developers to have both HTML reports AND stdout reports at the same
time. Right now there is no way to make that happen as, once you provide a value
for ``settings.COVERAGE_REPORT_HTML_OUTPUT_DIR`` your STDOUT reports are

  • Participants
  • Parent commits 15fd7d2
  • Branches test_coverage

Comments (0)

Files changed (2)

File django_coverage/coverage_runner.py

View file
  • Ignore whitespace
             coverage_modules, settings.COVERAGE_MODULE_EXCLUDES,
-        outdir = settings.COVERAGE_REPORT_HTML_OUTPUT_DIR
-        if outdir is None:
+        if settings.COVERAGE_USE_STDOUT:
             coverage.report(modules.values(), show_missing=1)
             if excludes:
                 message = "The following packages or modules were excluded:"
                 for e in errors:
                     print >>sys.stderr, e,
                 print >>sys.stdout
-        else:
+        outdir = settings.COVERAGE_REPORT_HTML_OUTPUT_DIR
+        if outdir:
             outdir = os.path.abspath(outdir)
             if settings.COVERAGE_CUSTOM_REPORTS:
                 html_report(outdir, modules, excludes, errors)

File django_coverage/settings.py

View file
  • Ignore whitespace
 # True => html reports by 55minutes
 # False => html reports by coverage.py
+# True => Always output coverage reports to STDOUT.
+# False => Don't output coverage reports to STDOUT.
+# This makes it possible to both generate HTML reports and see coverage
+# information on STDOUT.