![]() | Ned Batchelder : Blog | Code | Text | Site Contributing to coverage.py » Home : Code : coverage.py |
Created 12 November 2012 I welcome contributions to coverage.py. Over the years, dozens of people have provided patches of various sizes to add features or fix bugs. This page should have all the information you need to make a contribution. One source of history or ideas are the bug reports against coverage.py. There you can find ideas for requested features, or the remains of rejected ideas. Before you beginIf you have an idea for coverage.py, run it by me before you begin writing code. This way, I can get you going in the right direction, or point you to previous work in the area. Things are not always as straightforward as they seem, and having the benefit of lessons learned by those before you can save you frustration. Getting the codeThe coverage.py code is hosted on a Mercurial repository at https://bitbucket.org/ned/coveragepy. To get a working environment, follow these steps:
Running the testsThe tests are written as standard unittest-style tests, and are run with tox: $ tox Tox runs the complete test suite twice for each version of Python you have installed. The first run uses the Python implementation of the trace function, the second uses the C implementation. To limit tox to just a few versions of Python, use the -e switch: $ tox -e py27,py33 To run just a few tests, you can use nose test selector syntax: $ tox test.test_misc:SetupPyTest.test_metadata This looks in test/test_misc.py to find the SetupPyTest class, and runs the test_metadata test method. Of course, run all the tests on every version of Python you have, before submitting a change. Lint, etcI try to keep the coverage.py as clean as possible. I use pylint to alert me to possible problems: $ make lint The source is pylint-clean, even if it’s because there are pragmas quieting some warnings. Please try to keep it that way, but don’t let pylint warnings keep you from sending patches. I can clean them up. Coverage testing coverage.pyCoverage.py can measure itself, but it’s complicated. The process has been packaged up to make it easier: $ COVERAGE_COVERAGE=yes tox Then look at htmlcov/index.html. Note that due to the recursive nature of coverage.py measuring itself, there are some parts of the code that will never appear as covered, even though they are executed. ContributingWhen you are ready to contribute a change, any way you can get it to me is probably fine. A pull request on Bitbucket is great, but a simple diff or patch is great too. « Previous: Coverage API Next: Things that cause trouble » | |