Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: tools/telemetry/third_party/coverage/doc/contributing.rst

Issue 1366913004: Add coverage Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 .. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2 .. For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
3
4 .. _contributing:
5
6 ===========================
7 Contributing to coverage.py
8 ===========================
9
10 .. :history: 20121112T154100, brand new docs.
11
12 .. highlight:: console
13
14 I welcome contributions to coverage.py. Over the years, dozens of people have
15 provided patches of various sizes to add features or fix bugs. This page
16 should have all the information you need to make a contribution.
17
18 One source of history or ideas are the `bug reports`_ against coverage.py.
19 There you can find ideas for requested features, or the remains of rejected
20 ideas.
21
22 .. _bug reports: https://bitbucket.org/ned/coveragepy/issues?status=new&status=o pen
23
24
25 Before you begin
26 ----------------
27
28 If you have an idea for coverage.py, run it by me before you begin writing
29 code. This way, I can get you going in the right direction, or point you to
30 previous work in the area. Things are not always as straightforward as they
31 seem, and having the benefit of lessons learned by those before you can save
32 you frustration.
33
34
35 Getting the code
36 ----------------
37
38 The coverage.py code is hosted on a `Mercurial`_ repository at
39 https://bitbucket.org/ned/coveragepy. To get a working environment, follow
40 these steps:
41
42 #. (Optional, but recommended) Create a virtualenv to work in, and activate
43 it.
44
45 #. Clone the repo::
46
47 $ hg clone https://bitbucket.org/ned/coveragepy
48 $ cd coveragepy
49
50 #. Install the requirements::
51
52 $ pip install -r requirements/dev.pip
53
54 #. Install a number of versions of Python. Coverage.py supports a wide range
55 of Python versions. The more you can test with, the more easily your code
56 can be used as-is. If you only have one version, that's OK too, but may
57 mean more work integrating your contribution.
58
59
60 Running the tests
61 -----------------
62
63 The tests are written as standard unittest-style tests, and are run with
64 `tox`_::
65
66 $ tox
67 py27 create: /Users/ned/coverage/trunk/.tox/py27
68 py27 installdeps: nose==1.3.7, mock==1.3.0, PyContracts==1.7.6, gevent==1.0. 2, eventlet==0.17.4, greenlet==0.4.7
69 py27 develop-inst: /Users/ned/coverage/trunk
70 py27 installed: -f /Users/ned/Downloads/local_pypi,-e hg+ssh://hg@bitbucket. org/ned/coveragepy@22fe9a2b7796f6498aa013c860c268ac21651226#egg=coverage-dev,dec orator==4.0.2,eventlet==0.17.4,funcsigs==0.4,gevent==1.0.2,greenlet==0.4.7,mock= =1.3.0,nose==1.3.7,pbr==1.6.0,PyContracts==1.7.6,pyparsing==2.0.3,six==1.9.0,whe el==0.24.0
71 py27 runtests: PYTHONHASHSEED='1294330776'
72 py27 runtests: commands[0] | python setup.py --quiet clean develop
73 py27 runtests: commands[1] | python igor.py zip_mods install_egg remove_exte nsion
74 py27 runtests: commands[2] | python igor.py test_with_tracer py
75 === CPython 2.7.10 with Python tracer (.tox/py27/bin/python) ===
76 ............................................................................ (etc)
77 ----------------------------------------------------------------------
78 Ran 592 tests in 65.524s
79
80 OK (SKIP=20)
81 py27 runtests: commands[3] | python setup.py --quiet build_ext --inplace
82 py27 runtests: commands[4] | python igor.py test_with_tracer c
83 === CPython 2.7.10 with C tracer (.tox/py27/bin/python) ===
84 ............................................................................ (etc)
85 ----------------------------------------------------------------------
86 Ran 592 tests in 69.635s
87
88 OK (SKIP=4)
89 py33 create: /Users/ned/coverage/trunk/.tox/py33
90 py33 installdeps: nose==1.3.7, mock==1.3.0, PyContracts==1.7.6, greenlet==0. 4.7
91 py33 develop-inst: /Users/ned/coverage/trunk
92 py33 installed: -f /Users/ned/Downloads/local_pypi,-e hg+ssh://hg@bitbucket. org/ned/coveragepy@22fe9a2b7796f6498aa013c860c268ac21651226#egg=coverage-dev,dec orator==4.0.2,greenlet==0.4.7,mock==1.3.0,nose==1.3.7,pbr==1.6.0,PyContracts==1. 7.6,pyparsing==2.0.3,six==1.9.0,wheel==0.24.0
93 py33 runtests: PYTHONHASHSEED='1294330776'
94 py33 runtests: commands[0] | python setup.py --quiet clean develop
95 py33 runtests: commands[1] | python igor.py zip_mods install_egg remove_exte nsion
96 py33 runtests: commands[2] | python igor.py test_with_tracer py
97 === CPython 3.3.6 with Python tracer (.tox/py33/bin/python) ===
98 ............................................S............................... (etc)
99 ----------------------------------------------------------------------
100 Ran 592 tests in 73.007s
101
102 OK (SKIP=22)
103 py33 runtests: commands[3] | python setup.py --quiet build_ext --inplace
104 py33 runtests: commands[4] | python igor.py test_with_tracer c
105 === CPython 3.3.6 with C tracer (.tox/py33/bin/python) ===
106 ............................................S............................... (etc)
107 ----------------------------------------------------------------------
108 Ran 592 tests in 72.071s
109
110 OK (SKIP=5)
111 (and so on...)
112
113 Tox runs the complete test suite twice for each version of Python you have
114 installed. The first run uses the Python implementation of the trace function,
115 the second uses the C implementation.
116
117 To limit tox to just a few versions of Python, use the ``-e`` switch::
118
119 $ tox -e py27,py33
120
121 To run just a few tests, you can use nose test selector syntax::
122
123 $ tox tests.test_misc:SetupPyTest.test_metadata
124
125 This looks in `tests/test_misc.py` to find the `SetupPyTest` class, and runs
126 the `test_metadata` test method.
127
128 Of course, run all the tests on every version of Python you have, before
129 submitting a change.
130
131
132 Lint, etc
133 ---------
134
135 I try to keep the coverage.py as clean as possible. I use pylint to alert me
136 to possible problems::
137
138 $ make lint
139 pylint coverage setup.py tests
140 python -m tabnanny coverage setup.py tests
141 python igor.py check_eol
142
143 The source is pylint-clean, even if it's because there are pragmas quieting
144 some warnings. Please try to keep it that way, but don't let pylint warnings
145 keep you from sending patches. I can clean them up.
146
147 Lines should be kept to a 100-character maximum length.
148
149
150 Coverage testing coverage.py
151 ----------------------------
152
153 Coverage.py can measure itself, but it's complicated. The process has been
154 packaged up to make it easier::
155
156 $ make metacov metahtml
157
158 Then look at htmlcov/index.html. Note that due to the recursive nature of
159 coverage.py measuring itself, there are some parts of the code that will never
160 appear as covered, even though they are executed.
161
162
163 Contributing
164 ------------
165
166 When you are ready to contribute a change, any way you can get it to me is
167 probably fine. A pull request on Bitbucket is great, but a simple diff or
168 patch is great too.
169
170
171 .. _Mercurial: http://mercurial.selenic.com/
172 .. _tox: http://tox.testrun.org/
OLDNEW
« no previous file with comments | « tools/telemetry/third_party/coverage/doc/config.rst ('k') | tools/telemetry/third_party/coverage/doc/dict.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698