trouble.rst 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. .. _trouble:
  4. =========================
  5. Things that cause trouble
  6. =========================
  7. .. :history: 20121231T085200, brand new docs.
  8. .. :history: 20150124T160800, remove obsolete stuff.
  9. Coverage.py works well, and I want it to properly measure any Python program,
  10. but 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
  12. with more information.
  13. I would love to :ref:`hear from you <contact>` if you have information about
  14. any of these problems, even just to explain to me why you want them to start
  15. working properly.
  16. If your problem isn't discussed here, you can of course search the `coverage.py
  17. bug tracker`_ directly to see if there is some mention of it.
  18. .. _coverage.py bug tracker: https://bitbucket.org/ned/coveragepy/issues?status=new&status=open
  19. Things that don't work
  20. ----------------------
  21. There are a number of popular modules, packages, and libraries that prevent
  22. coverage.py from working properly:
  23. * `execv`_, or one of its variants. These end the current program and replace
  24. it with a new one. This doesn't save the collected coverage data, so your
  25. program that calls execv will not be fully measured. A patch for coverage.py
  26. is in `issue 43`_.
  27. * `thread`_, in the Python standard library, is the low-level threading
  28. interface. Threads created with this module will not be traced. Use the
  29. higher-level `threading`_ module instead.
  30. * `sys.settrace`_ is the Python feature that coverage.py uses to see what's
  31. happening in your program. If another part of your program is using
  32. sys.settrace, then it will conflict with coverage.py, and it won't be
  33. measured properly.
  34. .. _execv: http://docs.python.org/library/os#os.execl
  35. .. _sys.settrace: http://docs.python.org/library/sys.html#sys.settrace
  36. .. _thread: https://docs.python.org/2/library/thread.html
  37. .. _threading: http://docs.python.org/library/threading.html
  38. .. _issue 43: https://bitbucket.org/ned/coveragepy/issue/43/coverage-measurement-fails-on-code
  39. Things that require --timid
  40. ---------------------------
  41. Some packages interfere with coverage measurement, but you might be able to
  42. make it work by using the ``--timid`` command-line switch, or the ``[run]
  43. timid=True`` configuration option.
  44. * `DecoratorTools`_, or any package which uses it, notably `TurboGears`_.
  45. DecoratorTools fiddles with the trace function. You will need to use
  46. ``--timid``.
  47. .. _DecoratorTools: http://pypi.python.org/pypi/DecoratorTools
  48. .. _TurboGears: http://turbogears.org/
  49. Still having trouble?
  50. ---------------------
  51. If your problem isn't mentioned here, and isn't already reported in the
  52. `coverage.py bug tracker`_, please :ref:`get in touch with me <contact>`,
  53. we'll figure out a solution.