Commits

Matthew Schinckel committed cd0303e

Updated documentation about badges.
Include the coverage badge in the html index page.

  • Participants
  • Parent commits 4db5cd9
  • Branches badges

Comments (0)

Files changed (3)

    See ``settings.py`` for more detail.
 3. Run ``manage.py test`` like you normally do.
 
+
+Extras
+======
+Coverage badges
+---------------
+``django_coverage`` will also generate a badge image that represents
+the percentage coverage that your project has.
+
+This will be stored in the same directory as the coverage report data:
+``$PROJECT/.coverage/coverage_status.png``.
+
+Currently, the only badge type that is included is drone.io_. When other
+types are included, you will be able to select which is used by 
+``settings.COVERAGE_BADGE_TYPE``.
+
+To prevent the badge generation, you could set this to ``None``.
+
+
 And that's it.
 
 

File django_coverage/utils/coverage_report/html_report.py

     print >>fo, module_index.BOTTOM
     fo.close()
     
-    badge = open(os.path.join(
-        os.path.dirname(__file__), 
-        'badges', 
-        settings.COVERAGE_BADGE_TYPE, 
-        '%s.png' % int(overall_covered)
-    )).read()
-    open(os.path.join(outdir, 'coverage_status.png'), 'wb').write(badge)
+    if settings.COVERAGE_BADGE_TYPE:
+        badge = open(os.path.join(
+            os.path.dirname(__file__),
+            'badges',
+            settings.COVERAGE_BADGE_TYPE,
+            '%s.png' % int(overall_covered)
+        )).read()
+        open(os.path.join(outdir, 'coverage_status.png'), 'wb').write(badge)
 

File django_coverage/utils/coverage_report/templates/default_module_index.py

 <div id="content-header">
   <h1>Test Coverage Report</h1>
   <p>Generated: %(test_timestamp)s</p>
+  <p><img src="coverage_status.png"></p>
 </div>
 """