| OLD | NEW |
| 1 .. _trouble: | 1 .. _trouble: |
| 2 | 2 |
| 3 ========================= | 3 ========================= |
| 4 Things that cause trouble | 4 Things that cause trouble |
| 5 ========================= | 5 ========================= |
| 6 | 6 |
| 7 :history: 20121231T085200, brand new docs. | 7 :history: 20121231T085200, brand new docs. |
| 8 | 8 |
| 9 Coverage works well, and I want it to properly measure any Python program, but | 9 Coverage works well, and I want it to properly measure any Python program, but |
| 10 there are some situations it can't cope with. This page details some known | 10 there are some situations it can't cope with. This page details some known |
| 11 problems, with possible courses of action, and links to coverage.py bug reports | 11 problems, with possible courses of action, and links to coverage.py bug reports |
| 12 with more information. | 12 with more information. |
| 13 | 13 |
| 14 I would love to :ref:`hear from you <contact>` if you have information about any
of | 14 I would love to :ref:`hear from you <contact>` if you have information about |
| 15 these problems, even just to explain to me why you want them to start working | 15 any of these problems, even just to explain to me why you want them to start |
| 16 properly. | 16 working properly. |
| 17 | 17 |
| 18 If your problem isn't discussed here, you can of course search the `coverage.py | 18 If your problem isn't discussed here, you can of course search the `coverage.py |
| 19 bug tracker`_ directly to see if there is some mention of it. | 19 bug tracker`_ directly to see if there is some mention of it. |
| 20 | 20 |
| 21 .. _coverage.py bug tracker: https://bitbucket.org/ned/coveragepy/issues?status=
new&status=open | 21 .. _coverage.py bug tracker: https://bitbucket.org/ned/coveragepy/issues?status=
new&status=open |
| 22 | 22 |
| 23 | 23 |
| 24 Things that don't work | 24 Things that don't work |
| 25 ---------------------- | 25 ---------------------- |
| 26 | 26 |
| 27 There are a number of popular modules, packages, and libraries that prevent | 27 There are a number of popular modules, packages, and libraries that prevent |
| 28 coverage.py from working properly: | 28 coverage.py from working properly: |
| 29 | 29 |
| 30 * `execv`_, or one of its variants. These end the current program and replace | 30 * `execv`_, or one of its variants. These end the current program and replace |
| 31 it with a new one. This doesn't save the collected coverage data, so your | 31 it with a new one. This doesn't save the collected coverage data, so your |
| 32 program that calls execv will not be fully measured. A patch for coverage.py | 32 program that calls execv will not be fully measured. A patch for coverage.py |
| 33 is in `issue 43`_. | 33 is in `issue 43`_. |
| 34 | 34 |
| 35 * `multiprocessing`_ launches processes to provide parallelism. These | 35 * `multiprocessing`_ launches processes to provide parallelism. These |
| 36 processes don't get measured by coverage.py. Some possible fixes are | 36 processes don't get measured by coverage.py. Some possible fixes are |
| 37 discussed or linked to in `issue 117`_. | 37 discussed or linked to in `issue 117`_. |
| 38 | 38 |
| 39 * `gevent`_, which is based on `greenlet`_, and is similar to `eventlet`_. All | 39 * `gevent`_, which is based on `greenlet`_, and is similar to `eventlet`_. All |
| 40 of these manipulate the C stack, and therefore confuse coverage.py. | 40 of these manipulate the C stack, and therefore confuse coverage.py. |
| 41 `Issue 149`_ has some pointers to more information. | 41 `Issue 149`_ has some pointers to more information. |
| 42 | 42 |
| 43 * `thread`_, in the Python standard library, is the low-level threading |
| 44 interface. Threads created with this module will not be traced. Use the |
| 45 higher-level `threading`_ module instead. |
| 46 |
| 43 * `sys.settrace`_ is the Python feature that coverage.py uses to see what's | 47 * `sys.settrace`_ is the Python feature that coverage.py uses to see what's |
| 44 happening in your program. If another part of your program is using | 48 happening in your program. If another part of your program is using |
| 45 sys.settrace, then it will conflict with coverage.py, and it won't be | 49 sys.settrace, then it will conflict with coverage.py, and it won't be |
| 46 measured properly. | 50 measured properly. |
| 47 | 51 |
| 48 .. _execv: http://docs.python.org/library/os#os.execl | 52 .. _execv: http://docs.python.org/library/os#os.execl |
| 49 .. _multiprocessing: http://docs.python.org/library/multiprocessing.html | 53 .. _multiprocessing: http://docs.python.org/library/multiprocessing.html |
| 50 .. _gevent: http://www.gevent.org/ | 54 .. _gevent: http://www.gevent.org/ |
| 51 .. _greenlet: http://greenlet.readthedocs.org/ | 55 .. _greenlet: http://greenlet.readthedocs.org/ |
| 52 .. _eventlet: http://eventlet.net/ | 56 .. _eventlet: http://eventlet.net/ |
| 53 .. _sys.settrace: docs.python.org/library/sys.html#sys.settrace | 57 .. _sys.settrace: http://docs.python.org/library/sys.html#sys.settrace |
| 58 .. _thread: http://docs.python.org/library/thread.html |
| 59 .. _threading: http://docs.python.org/library/threading.html |
| 54 .. _issue 43: https://bitbucket.org/ned/coveragepy/issue/43/coverage-measurement
-fails-on-code | 60 .. _issue 43: https://bitbucket.org/ned/coveragepy/issue/43/coverage-measurement
-fails-on-code |
| 55 .. _issue 117: https://bitbucket.org/ned/coveragepy/issue/117/enable-coverage-me
asurement-of-code-run-by | 61 .. _issue 117: https://bitbucket.org/ned/coveragepy/issue/117/enable-coverage-me
asurement-of-code-run-by |
| 56 .. _issue 149: https://bitbucket.org/ned/coveragepy/issue/149/coverage-gevent-lo
oks-broken | 62 .. _issue 149: https://bitbucket.org/ned/coveragepy/issue/149/coverage-gevent-lo
oks-broken |
| 57 | 63 |
| 58 | 64 |
| 59 Things that require --timid | 65 Things that require --timid |
| 60 --------------------------- | 66 --------------------------- |
| 61 | 67 |
| 62 Some packages interfere with coverage measurement, but you might be able to | 68 Some packages interfere with coverage measurement, but you might be able to |
| 63 make it work by using the ``--timid`` command-line switch, or the ``[run] | 69 make it work by using the ``--timid`` command-line switch, or the ``[run] |
| 64 timid=True`` configuration option. | 70 timid=True`` configuration option. |
| 65 | 71 |
| 66 * `DecoratorTools`_, or any package which uses it, notably `TurboGears`_. | 72 * `DecoratorTools`_, or any package which uses it, notably `TurboGears`_. |
| 67 DecoratorTools fiddles with the trace function. You will need to use | 73 DecoratorTools fiddles with the trace function. You will need to use |
| 68 ``--timid``. | 74 ``--timid``. |
| 69 | 75 |
| 70 .. _DecoratorTools: http://pypi.python.org/pypi/DecoratorTools | 76 .. _DecoratorTools: http://pypi.python.org/pypi/DecoratorTools |
| 71 .. _TurboGears: http://turbogears.org/ | 77 .. _TurboGears: http://turbogears.org/ |
| 72 | 78 |
| 73 | 79 |
| 74 Really obscure things | 80 Really obscure things |
| 75 --------------------- | 81 --------------------- |
| 76 | 82 |
| 77 * Python 2.5 had a bug (`1569356`_) that could make your program behave | 83 * Python 2.5 had a bug (`1569356`_) that could make your program behave |
| 78 differently when being measured with coverage. This is diagnosed in `issue 51
`_. | 84 differently when being measured with coverage. This is diagnosed in |
| 85 `issue 51`_. |
| 79 | 86 |
| 80 .. _issue 51: http://bitbucket.org/ned/coveragepy/issue/51/turbogears-15-test-fa
iling-with-coverage | 87 .. _issue 51: http://bitbucket.org/ned/coveragepy/issue/51/turbogears-15-test-fa
iling-with-coverage |
| 81 .. _1569356: http://bugs.python.org/issue1569356 | 88 .. _1569356: http://bugs.python.org/issue1569356 |
| 82 | 89 |
| 83 | 90 |
| 84 Still having trouble? | 91 Still having trouble? |
| 85 --------------------- | 92 --------------------- |
| 86 | 93 |
| 87 If your problem isn't mentioned here, and isn't already reported in the `coverag
e.py bug tracker`_, | 94 If your problem isn't mentioned here, and isn't already reported in the |
| 88 please :ref:`get in touch with me <contact>`, we'll figure out a solution. | 95 `coverage.py bug tracker`_, please :ref:`get in touch with me <contact>`, |
| 96 we'll figure out a solution. |
| OLD | NEW |