Randall Degges avatar 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.

Comments (0)

Files changed (2)

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)

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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.