| | 13 | Okay, so it didn't work, because there is no file by that name. Create such a file, with these contents: |
| | 14 | |
| | 15 | {{{ |
| | 16 | rom twisted.trial import unittest |
| | 17 | |
| | 18 | class T(unittest.TestCase): |
| | 19 | def test_a(self): |
| | 20 | pass |
| | 21 | }}} |
| | 22 | |
| | 23 | Now install Ned Batchelder's "[http://nedbatchelder.com/code/coverage/ coverage"] tool and run your with code coverage, like this: |
| | 24 | |
| | 25 | {{{ |
| | 26 | ./bin/tahoe @coverage run --branch --include='src/allmydata/*' @tahoe debug trial allmydata.test.test_fname |
| | 27 | }}} |
| | 28 | |
| | 29 | If you installed coverage from Debian or Ubuntu then you have to name it {{{python-coverage}}}, like this: |
| | 30 | |
| | 31 | {{{ |
| | 32 | ./bin/tahoe @python-coverage run --branch --include='src/allmydata/*' @tahoe debug trial allmydata.test.test_fname |
| | 33 | }}} |
| | 34 | |
| | 35 | This does the same as running the tests without coverage -- print a list of what happened when each test was run. It also writes out a file named {{{.coverage}}} into the current directory. Run the following command to read that file and produce nice HTML pages: |
| | 36 | |
| | 37 | {{{ |
| | 38 | ./bin/tahoe @coverage html |
| | 39 | }}} |
| | 40 | |
| | 41 | That will product a directory named {{{htmlcov}}}. View its contents with a web browser. |