Code

Opened 3 years ago

Closed 21 months ago

Last modified 21 months ago

#16817 closed Cleanup/optimization (fixed)

Add a guide on code coverage to contributing docs

Reported by: julien Owned by: pvl
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: preston@…, pvl 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 3 years ago.
Coverage.py conf file to make the process easier

Download all attachments as: .zip

Change History (11)

Changed 3 years ago by julien

Coverage.py conf file to make the process easier

comment:1 Changed 3 years ago by Alex

  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by ptone

  • Cc preston@… added

comment:3 Changed 3 years ago by aaugustin

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

Related ticket: #4501

comment:4 Changed 3 years ago by krzysiumed

  • Owner changed from nobody to krzysiumed
  • Status changed from new to assigned

comment:5 Changed 3 years ago by krzysiumed

  • Owner krzysiumed deleted
  • Status changed from assigned to new

comment:6 Changed 2 years ago by pvl

  • Owner set to pvl
  • Status changed from new to assigned

comment:7 Changed 2 years ago by pvl

  • Cc pvl added
  • Triage Stage changed from Accepted to Ready 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 2 years ago by pvl

  • Triage Stage changed from Ready for checkin to Accepted

comment:9 Changed 21 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 06f5da3d7813e9a23b1e98ecf8b75fc6073800e9:

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

Thanks Pedro Lima for the draft patch.

comment:10 Changed 21 months 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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.