Commits

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
suppressed.

  • Participants
  • Parent commits 15fd7d2

Comments (0)

Files changed (2)

File django_coverage/coverage_runner.py

             coverage_modules, settings.COVERAGE_MODULE_EXCLUDES,
             settings.COVERAGE_PATH_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

 # True => html reports by 55minutes
 # False => html reports by coverage.py
 COVERAGE_CUSTOM_REPORTS = getattr(settings, 'COVERAGE_CUSTOM_REPORTS', True)
+
+
+# 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.
+COVERAGE_USE_STDOUT = getattr(settings, 'COVERAGE_USE_STDOUT', True)