Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#16817 closed Cleanup/optimization (fixed)

Add a guide on code coverage to contributing docs

Reported by: Julien Phalip Owned by: Pedro Lima
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: preston@…, Pedro Lima Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

Increasing code coverage is a good place to start for new contributors to get acquainted both with the Django codebase and with its test suite. Python core has a nice guide for it [1] and it'd be useful for Django to have one too. The guide would explain how to install the coverage.py module, run it on top of the runtests script, generate the reports, etc.:

$ coverage run ./runtests.py --settings=test_sqlite
$ coverage html

Some embedded third-party modules should be excluded so as to not mess up the results. This exclusion would be facilitated by adding a configuration file to django/tests/ (see attachment).

It would also be useful to have a regularly-updated online report that one could easily refer to. There's already one on the CI server [2], which is a great start, although it is using Cobertura instead of coverage.py.

[1] http://docs.python.org/devguide/coverage.html

[2] http://ci.django-cms.org/job/Django%20Coverage/cobertura

Attachments (1)

16817.runtests-coverage.diff (1.4 KB) - added by Julien Phalip 5 years ago.
Coverage.py conf file to make the process easier

Download all attachments as: .zip

Change History (11)

Changed 5 years ago by Julien Phalip

Coverage.py conf file to make the process easier

comment:1 Changed 5 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:2 Changed 5 years ago by Preston Holmes

Cc: preston@… added

comment:3 Changed 5 years ago by Aymeric Augustin

Easy pickings: set
Has patch: set
Patch needs improvement: set

Related ticket: #4501

comment:4 Changed 5 years ago by Christopher Medrela

Owner: changed from nobody to Christopher Medrela
Status: newassigned

comment:5 Changed 5 years ago by Christopher Medrela

Owner: Christopher Medrela deleted
Status: assignednew

comment:6 Changed 4 years ago by Pedro Lima

Owner: set to Pedro Lima
Status: newassigned

comment:7 Changed 4 years ago by Pedro Lima

Cc: Pedro Lima added
Triage Stage: AcceptedReady for checkin

Included this patch and added documentation for coverage installation and use (also based on the documentation work of krzysiumed in #4501)

https://github.com/django/django/pull/120

comment:8 Changed 4 years ago by Pedro Lima

Triage Stage: Ready for checkinAccepted

comment:9 Changed 4 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 06f5da3d7813e9a23b1e98ecf8b75fc6073800e9:

Fixed #16817 - Added a guide of code coverage to contributing docs.

Thanks Pedro Lima for the draft patch.

comment:10 Changed 4 years ago by Tim Graham <timograham@…>

In 3ac70a5907e054c734ca26e435f1ec1215797b08:

[1.4.X] Fixed #16817 - Added a guide of code coverage to contributing docs.

Thanks Pedro Lima for the draft patch.

Backport of 06f5da3d78 from master

Note: See TracTickets for help on using tickets.
Back to Top