-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathREADME.txt
73 lines (42 loc) · 2.94 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Django Test Coverage
====================
Overview
--------
The test runner is an extended version of the default django test runner. It adds the ability to get coverage reports from defined modules or tested apps.
.. _Coverage: http://nedbatchelder.com/code/modules/coverage.html
Update(11-20-13)
------
This version(0.2.5) supports python 3.3.x and django 1.6
Usage
-----
Simple add the line
Add 'django_test_runner' to INSTALLED_APPS
Django 1.3 and earlier:
TEST_RUNNER = 'django_test_coverage.runner.run_tests'
Django 1.4 to 1.6:
TEST_RUNNER = 'django_test_coverage.runner.CoverageTestSuiteRunner'
to your django settings file. If you run the test with
python manage.py test zoo
the test runner will evaluate all modules in the app *zoo* and add them to the coverage report. You can also specify a set of modules by adding the line
COVERAGE_MODULES = ('zoo.baer', 'zoo.lion')
to your settings file. In this example *zoo* should be replaced with your application name and *baer/lion* with your module included in the reported. Modules can be ignored with
COVERAGE_EXCLUDE_MODULES = ('zoo.tests',)
This will exclude *zoo.tests* and all its submodules from the coverage statistics.
You can also specify a set of apps to test. This option performs in a similar manner to specifying specific apps on the command line, but here you can specify a default set of apps to test in the settings file. To specify a set of apps, add the line
COVERAGE_APPS = ('zoo',)
to your settings file. In this example, the test runner will evaluate all modules in the app *zoo* and add them to the coverage report whenever you run the following line
python manage.py test
Any apps specified at the command line will override the COVERAGE_MODULES and COVERAGE_APPS options.
Reporters
---------
In addition to the default console reporter, you can specify either 'html' or 'xml' as the value of COVERAGE_REPORT_TYPE.
The HTML reporter has the following options:
COVERAGE_HTML_DIRECTORY: Directory to output html to; defaults to covhtml in the current directory. If the directory doesn't exist it'll be created.
COVERAGE_HTML_EXTRA_CSS: An extra css file that coverage'll copy into the output directory if given; defaults to None.
COVERAGE_HTML_OPEN_IN_BROWSER: Whether or not to open the index file after generation. Uses the webbrowser module to do so. Default is False.
COVERAGE_HTML_BROWSER_OPEN_TYPE: If COVERAGE_HTML_OPEN_IN_BROWSER is True, then this dictates how the open is done. Possible values are 'existing' (use existing browser window), 'new' (try and open a new browser), or 'tab' (python >= 2.5 only; attempts to open in a new tab). See http://docs.python.org/library/webbrowser.html#webbrowser.open for details.
The XML reporter has the following options:
COVERAGE_XML_FILE: Specifies the output path or outputs to coverage.xml if not specified.
Limitations
-----------
So far no implementation to wrap around djangos PostGIS test runner.