Code

Ticket #4501: 4501_v4.diff

File 4501_v4.diff, 1.5 KB (added by krzysiumed, 3 years ago)
Line 
1diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
2index dc5bf7e..3749300 100644
3--- a/docs/topics/testing.txt
4+++ b/docs/topics/testing.txt
5@@ -552,6 +552,39 @@ failed and erroneous tests. If all the tests pass, the return code is 0. This
6 feature is useful if you're using the test-runner script in a shell script and
7 need to test for success or failure at that level.
8 
9+Integration with coverage.py module
10+-----------------------------------
11+
12+Checking code coverage is important part of testing applications and it's
13+strongly recommended to do it. Django can be integrated with `coverage.py module`_.
14+First, you have to `install coverage.py`_. Now you are ready to use coverage
15+module. Type in your shell:
16+
17+.. _coverage.py module: http://nedbatchelder.com/code/coverage/
18+.. _install coverage.py: http://pypi.python.org/pypi/coverage
19+
20+.. code-block:: bash
21+
22+   coverage -x manage.py test myapp
23+
24+Now tests were launched and coverage data was collected. For each executed file
25+there was created another file with name ending with ``,cover`` containing data
26+about coverage. You can open these files or you can print coverage summary
27+by typing following command.
28+
29+.. code-block:: bash
30+
31+   coverage -r
32+
33+After this all don't forget to delete all collected data by typing:
34+
35+.. code-block:: bash
36+
37+   coverage -e
38+
39+Note that if you don't run last command, coverage data from next launching
40+will be append to existing data.
41+
42 Testing tools
43 =============
44