Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #4501 - Documented how to use coverage.py with Django tests.

Thanks krzysiumed for the draft patch.
  • Loading branch information...
commit 7ef2781ca0ce48872e21dce2f322c9e4106d1cfd 1 parent f7b6966
Tim Graham timgraham authored

Showing 1 changed file with 28 additions and 0 deletions. Show diff stats Hide diff stats

  1. +28 0 docs/topics/testing.txt
28 docs/topics/testing.txt
@@ -589,6 +589,34 @@ to a faster hashing algorithm::
589 589 Don't forget to also include in :setting:`PASSWORD_HASHERS` any hashing
590 590 algorithm used in fixtures, if any.
591 591
  592 +Integration with coverage.py
  593 +----------------------------
  594 +
  595 +Code coverage describes how much source code has been tested. It shows which
  596 +parts of your code are being exercised by tests and which are not. It's an
  597 +important part of testing applications, so it's strongly recommended to check
  598 +the coverage of your tests.
  599 +
  600 +Django can be easily integrated with `coverage.py`_, a tool for measuring code
  601 +coverage of Python programs. First, `install coverage.py`_. Next, run the
  602 +following from your project folder containing ``manage.py``::
  603 +
  604 + coverage run --source='.' manage.py test myapp
  605 +
  606 +This runs your tests and collects coverage data of the executed files in your
  607 +project. You can see a report of this data by typing following command::
  608 +
  609 + coverage report
  610 +
  611 +Note that some Django code was executed while running tests, but it is not
  612 +listed here because of the ``source`` flag passed to the previous command.
  613 +
  614 +For more options like annotated HTML listings detailing missed lines, see the
  615 +`coverage.py`_ docs.
  616 +
  617 +.. _coverage.py: http://nedbatchelder.com/code/coverage/
  618 +.. _install coverage.py: http://pypi.python.org/pypi/coverage
  619 +
592 620 Testing tools
593 621 =============
594 622

0 comments on commit 7ef2781

Please sign in to comment.
Something went wrong with that request. Please try again.