changes.rst 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  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. .. _changes:
  4. ====================================
  5. Major change history for coverage.py
  6. ====================================
  7. .. :history: 20090524T134300, brand new docs.
  8. .. :history: 20090613T164000, final touches for 3.0
  9. .. :history: 20090706T205000, changes for 3.0.1
  10. .. :history: 20091004T170700, changes for 3.1
  11. .. :history: 20091128T072200, changes for 3.2
  12. .. :history: 20091205T161525, 3.2 final
  13. .. :history: 20100221T151900, changes for 3.3
  14. .. :history: 20100306T181400, changes for 3.3.1
  15. .. :history: 20100725T211700, updated for 3.4.
  16. .. :history: 20100820T151500, updated for 3.4b1
  17. .. :history: 20100906T133800, updated for 3.4b2
  18. .. :history: 20100919T163400, updated for 3.4 release.
  19. .. :history: 20110604T214100, updated for 3.5b1
  20. .. :history: 20110629T082200, updated for 3.5
  21. .. :history: 20110923T081600, updated for 3.5.1
  22. .. :history: 20120429T162100, updated for 3.5.2b1
  23. .. :history: 20120503T233700, updated for 3.5.2
  24. .. :history: 20120929T093100, updated for 3.5.3
  25. .. :history: 20121129T060100, updated for 3.6b1.
  26. .. :history: 20121223T180600, updated for 3.6b2.
  27. .. :history: 20130105T173500, updated for 3.6
  28. .. :history: 20131005T205700, updated for 3.7
  29. .. :history: 20131212T213100, updated for 3.7.1
  30. .. :history: 20150124T134800, updated for 4.0a4
  31. .. :history: 20150802T174700, updated for 4.0b1
  32. .. :history: 20150822T092800, updated for 4.0b2
  33. .. :history: 20150919T072700, updated for 4.0
  34. .. :history: 20151013T103000, updated for 4.0.1
  35. .. :history: 20151104T050900, updated for 4.0.2
  36. .. :history: 20151124T065800, updated for 4.0.3
  37. .. :history: 20160110T125800, updated for 4.1b1
  38. .. :history: 20160510T125200, updated for 4.1b3
  39. .. :history: 20160521T074300, updated for 4.1
  40. These are the major changes for coverage.py. For a more complete change
  41. history, see the `CHANGES.rst`_ file in the source tree.
  42. .. _CHANGES.rst: http://bitbucket.org/ned/coveragepy/src/tip/CHANGES.rst
  43. .. module:: coverage
  44. .. _changes_42:
  45. Version 4.2 --- 2016-07-26
  46. --------------------------
  47. Work from the PyCon 2016 Sprints!
  48. - BACKWARD INCOMPATIBILITY: the ``coverage combine`` command now ignores an
  49. existing ``.coverage`` data file. It used to include that file in its
  50. combining. This caused confusing results, and extra tox "clean" steps. If
  51. you want the old behavior, use the new ``coverage combine --append`` option.
  52. - Since ``concurrency=multiprocessing`` uses subprocesses, options specified on
  53. the coverage.py command line will not be communicated down to them. Only
  54. options in the configuration file will apply to the subprocesses.
  55. Previously, the options didn't apply to the subprocesses, but there was no
  56. indication. Now it is an error to use ``--concurrency=multiprocessing`` and
  57. other run-affecting options on the command line. This prevents
  58. failures like those reported in `issue 495`_.
  59. - The ``concurrency`` option can now take multiple values, to support programs
  60. using multiprocessing and another library such as eventlet. This is only
  61. possible in the configuration file, not from the command line. The
  62. configuration file is the only way for sub-processes to all run with the same
  63. options. Fixes `issue 484`_. Thanks to Josh Williams for prototyping.
  64. - Using a ``concurrency`` setting of ``multiprocessing`` now implies
  65. ``--parallel`` so that the main program is measured similarly to the
  66. sub-processes.
  67. - When using `automatic subprocess measurement`_, running coverage commands
  68. would create spurious data files. This is now fixed, thanks to diagnosis and
  69. testing by Dan Riti. Closes `issue 492`_.
  70. - A new configuration option, ``report:sort``, controls what column of the
  71. text report is used to sort the rows. Thanks to Dan Wandschneider, this
  72. closes `issue 199`_.
  73. - The HTML report has a more-visible indicator for which column is being
  74. sorted. Closes `issue 298`_, thanks to Josh Williams.
  75. - Filtering the HTML report is now faster, thanks to Ville Skyttä.
  76. - If the HTML report cannot find the source for a file, the message now
  77. suggests using the ``-i`` flag to allow the report to continue. Closes
  78. `issue 231`_, thanks, Nathan Land.
  79. - When reports are ignoring errors, there's now a warning if a file cannot be
  80. parsed, rather than being silently ignored. Closes `issue 396`_. Thanks,
  81. Matthew Boehm.
  82. - A new option for ``coverage debug`` is available: ``coverage debug config``
  83. shows the current configuration. Closes `issue 454`_, thanks to Matthew
  84. Boehm.
  85. - Running coverage as a module (``python -m coverage``) no longer shows the
  86. program name as ``__main__.py``. Fixes `issue 478`_. Thanks, Scott Belden.
  87. - The `test_helpers` module has been moved into a separate pip-installable
  88. package: `unittest-mixins`_.
  89. .. _automatic subprocess measurement: http://coverage.readthedocs.io/en/latest/subprocess.html
  90. .. _issue 199: https://bitbucket.org/ned/coveragepy/issues/199/add-a-way-to-sort-the-text-report
  91. .. _issue 231: https://bitbucket.org/ned/coveragepy/issues/231/various-default-behavior-in-report-phase
  92. .. _issue 298: https://bitbucket.org/ned/coveragepy/issues/298/show-in-html-report-that-the-columns-are
  93. .. _issue 396: https://bitbucket.org/ned/coveragepy/issues/396/coverage-xml-shouldnt-bail-out-on-parse
  94. .. _issue 454: https://bitbucket.org/ned/coveragepy/issues/454/coverage-debug-config-should-be
  95. .. _issue 478: https://bitbucket.org/ned/coveragepy/issues/478/help-shows-silly-program-name-when-running
  96. .. _issue 484: https://bitbucket.org/ned/coveragepy/issues/484/multiprocessing-greenlet-concurrency
  97. .. _issue 492: https://bitbucket.org/ned/coveragepy/issues/492/subprocess-coverage-strange-detection-of
  98. .. _issue 495: https://bitbucket.org/ned/coveragepy/issues/495/branch-and-concurrency-are-conflicting
  99. .. _unittest-mixins: https://pypi.python.org/pypi/unittest-mixins
  100. .. _changes_41:
  101. Version 4.1 --- 2016-05-21
  102. --------------------------
  103. - Branch analysis has been rewritten: it used to be based on bytecode, but now
  104. uses AST analysis. This has changed a number of things:
  105. - More code paths are now considered runnable, especially in
  106. ``try``/``except`` structures. This may mean that coverage.py will
  107. identify more code paths as uncovered. This could either raise or lower
  108. your overall coverage number.
  109. - Python 3.5's ``async`` and ``await`` keywords are properly supported,
  110. fixing `issue 434`_.
  111. - Missing branches reported with ``coverage report -m`` will now say
  112. ``->exit`` for missed branches to the exit of a function, rather than a
  113. negative number. Fixes `issue 469`_.
  114. - Some long-standing branch coverage bugs were fixed:
  115. - `issue 129`_: functions with only a docstring for a body would
  116. incorrectly report a missing branch on the ``def`` line.
  117. - `issue 212`_: code in an ``except`` block could be incorrectly marked as
  118. a missing branch.
  119. - `issue 146`_: context managers (``with`` statements) in a loop or ``try``
  120. block could confuse the branch measurement, reporting incorrect partial
  121. branches.
  122. - `issue 422`_: in Python 3.5, an actual partial branch could be marked as
  123. complete.
  124. - During branch coverage of single-line callables like lambdas and
  125. generator expressions, coverage.py can now distinguish between them never
  126. being called, or being called but not completed. Fixes `issue 90`_,
  127. `issue 460`_ and `issue 475`_.
  128. - Pragmas to disable coverage measurement can now be used on decorator lines,
  129. and they will apply to the entire function or class being decorated. This
  130. implements the feature requested in `issue 131`_.
  131. - Multiprocessing support is now available on Windows. Thanks, Rodrigue
  132. Cloutier.
  133. - The HTML report has a few changes:
  134. - The HTML report now has a map of the file along the rightmost edge of the
  135. page, giving an overview of where the missed lines are. Thanks, Dmitry
  136. Shishov.
  137. - The HTML report now uses different monospaced fonts, favoring Consolas over
  138. Courier. Along the way, `issue 472`_ about not properly handling one-space
  139. indents was fixed. The index page also has slightly different styling, to
  140. try to make the clickable detail pages more apparent.
  141. - The XML report now produces correct package names for modules found in
  142. directories specified with ``source=``. Fixes `issue 465`_.
  143. - ``coverage --help`` and ``coverage --version`` now mention which tracer is
  144. installed, to help diagnose problems. The docs mention which features need
  145. the C extension. (`issue 479`_)
  146. - The `Coverage.report` function had two parameters with non-None defaults,
  147. which have been changed. `show_missing` used to default to True, but now
  148. defaults to None. If you had been calling `Coverage.report` without
  149. specifying `show_missing`, you'll need to explicitly set it to True to keep
  150. the same behavior. `skip_covered` used to default to False. It is now None,
  151. which doesn't change the behavior. This fixes `issue 485`_.
  152. - It's never been possible to pass a namespace module to one of the analysis
  153. functions, but now at least we raise a more specific error message, rather
  154. than getting confused. (`issue 456`_)
  155. - The `coverage.process_startup` function now returns the `Coverage` instance
  156. it creates, as suggested in `issue 481`_.
  157. .. _issue 90: https://bitbucket.org/ned/coveragepy/issues/90/lambda-expression-confuses-branch
  158. .. _issue 129: https://bitbucket.org/ned/coveragepy/issues/129/misleading-branch-coverage-of-empty
  159. .. _issue 131: https://bitbucket.org/ned/coveragepy/issues/131/pragma-on-a-decorator-line-should-affect
  160. .. _issue 146: https://bitbucket.org/ned/coveragepy/issues/146/context-managers-confuse-branch-coverage
  161. .. _issue 212: https://bitbucket.org/ned/coveragepy/issues/212/coverage-erroneously-reports-partial
  162. .. _issue 422: https://bitbucket.org/ned/coveragepy/issues/422/python35-partial-branch-marked-as-fully
  163. .. _issue 434: https://bitbucket.org/ned/coveragepy/issues/434/indexerror-in-python-35
  164. .. _issue 456: https://bitbucket.org/ned/coveragepy/issues/456/coverage-breaks-with-implicit-namespaces
  165. .. _issue 460: https://bitbucket.org/ned/coveragepy/issues/460/confusing-html-report-for-certain-partial
  166. .. _issue 461: https://bitbucket.org/ned/coveragepy/issues/461/multiline-asserts-need-too-many-pragma
  167. .. _issue 465: https://bitbucket.org/ned/coveragepy/issues/465/coveragexml-produces-package-names-with-an
  168. .. _issue 469: https://bitbucket.org/ned/coveragepy/issues/469/strange-1-line-number-in-branch-coverage
  169. .. _issue 472: https://bitbucket.org/ned/coveragepy/issues/472/html-report-indents-incorrectly-for-one
  170. .. _issue 475: https://bitbucket.org/ned/coveragepy/issues/475/generator-expression-is-marked-as-not
  171. .. _issue 479: https://bitbucket.org/ned/coveragepy/issues/479/clarify-the-need-for-the-c-extension
  172. .. _issue 481: https://bitbucket.org/ned/coveragepy/issues/481/asyncioprocesspoolexecutor-tracing-not
  173. .. _issue 485: https://bitbucket.org/ned/coveragepy/issues/485/coveragereport-ignores-show_missing-and
  174. .. _changes_403:
  175. Version 4.0.3 --- 2015-11-24
  176. ----------------------------
  177. - Fixed a mysterious problem that manifested in different ways: sometimes
  178. hanging the process (`issue 420`_), sometimes making database connections
  179. fail (`issue 445`_).
  180. - The XML report now has correct ``<source>`` elements when using a
  181. ``--source=`` option somewhere besides the current directory. This fixes
  182. `issue 439`_. Thanks, Arcady Ivanov.
  183. - Fixed an unusual edge case of detecting source encodings, described in
  184. `issue 443`_.
  185. - Help messages that mention the command to use now properly use the actual
  186. command name, which might be different than "coverage". Thanks to Ben
  187. Finney, this closes `issue 438`_.
  188. .. _issue 420: https://bitbucket.org/ned/coveragepy/issues/420/coverage-40-hangs-indefinitely-on-python27
  189. .. _issue 438: https://bitbucket.org/ned/coveragepy/issues/438/parameterise-coverage-command-name
  190. .. _issue 439: https://bitbucket.org/ned/coveragepy/issues/439/incorrect-cobertura-file-sources-generated
  191. .. _issue 443: https://bitbucket.org/ned/coveragepy/issues/443/coverage-gets-confused-when-encoding
  192. .. _issue 445: https://bitbucket.org/ned/coveragepy/issues/445/django-app-cannot-connect-to-cassandra
  193. .. _changes_402:
  194. Version 4.0.2 --- 2015-11-04
  195. ----------------------------
  196. - More work on supporting unusually encoded source. Fixed `issue 431`_.
  197. - Files or directories with non-ASCII characters are now handled properly,
  198. fixing `issue 432`_.
  199. - Setting a trace function with sys.settrace was broken by a change in 4.0.1,
  200. as reported in `issue 436`_. This is now fixed.
  201. - Officially support PyPy 4.0, which required no changes, just updates to the
  202. docs.
  203. .. _issue 431: https://bitbucket.org/ned/coveragepy/issues/431/couldnt-parse-python-file-with-cp1252
  204. .. _issue 432: https://bitbucket.org/ned/coveragepy/issues/432/path-with-unicode-characters-various
  205. .. _issue 436: https://bitbucket.org/ned/coveragepy/issues/436/disabled-coverage-ctracer-may-rise-from
  206. .. _changes_401:
  207. Version 4.0.1 --- 2015-10-13
  208. ----------------------------
  209. - When combining data files, unreadable files will now generate a warning
  210. instead of failing the command. This is more in line with the older
  211. coverage.py v3.7.1 behavior, which silently ignored unreadable files.
  212. Prompted by `issue 418`_.
  213. - The --skip-covered option would skip reporting on 100% covered files, but
  214. also skipped them when calculating total coverage. This was wrong, it should
  215. only remove lines from the report, not change the final answer. This is now
  216. fixed, closing `issue 423`_.
  217. - In 4.0, the data file recorded a summary of the system on which it was run.
  218. Combined data files would keep all of those summaries. This could lead to
  219. enormous data files consisting of mostly repetitive useless information. That
  220. summary is now gone, fixing `issue 415`_. If you want summary information,
  221. get in touch, and we'll figure out a better way to do it.
  222. - Test suites that mocked os.path.exists would experience strange failures, due
  223. to coverage.py using their mock inadvertently. This is now fixed, closing
  224. `issue 416`_.
  225. - Importing a ``__init__`` module explicitly would lead to an error:
  226. ``AttributeError: 'module' object has no attribute '__path__'``, as reported
  227. in `issue 410`_. This is now fixed.
  228. - Code that uses ``sys.settrace(sys.gettrace())`` used to incur a more than 2x
  229. speed penalty. Now there's no penalty at all. Fixes `issue 397`_.
  230. - Pyexpat C code will no longer be recorded as a source file, fixing
  231. `issue 419`_.
  232. - The source kit now contains all of the files needed to have a complete source
  233. tree, re-fixing `issue 137`_ and closing `issue 281`_.
  234. .. _issue 281: https://bitbucket.org/ned/coveragepy/issues/281/supply-scripts-for-testing-in-the
  235. .. _issue 397: https://bitbucket.org/ned/coveragepy/issues/397/stopping-and-resuming-coverage-with
  236. .. _issue 410: https://bitbucket.org/ned/coveragepy/issues/410/attributeerror-module-object-has-no
  237. .. _issue 415: https://bitbucket.org/ned/coveragepy/issues/415/repeated-coveragedataupdates-cause
  238. .. _issue 416: https://bitbucket.org/ned/coveragepy/issues/416/mocking-ospathexists-causes-failures
  239. .. _issue 418: https://bitbucket.org/ned/coveragepy/issues/418/json-parse-error
  240. .. _issue 419: https://bitbucket.org/ned/coveragepy/issues/419/nosource-no-source-for-code-path-to-c
  241. .. _issue 423: https://bitbucket.org/ned/coveragepy/issues/423/skip_covered-changes-reported-total
  242. .. _changes_40:
  243. Version 4.0 --- 2015-09-20
  244. --------------------------
  245. Backward incompatibilities:
  246. - Python versions supported are now:
  247. - CPython 2.6, 2.7, 3.3, 3.4 and 3.5
  248. - PyPy2 2.4, 2.6
  249. - PyPy3 2.4
  250. - The original command line switches (``-x`` to run a program, etc) are no
  251. longer supported.
  252. - The ``COVERAGE_OPTIONS`` environment variable is no longer supported. It was
  253. a hack for ``--timid`` before configuration files were available.
  254. - The original module-level function interface to coverage.py is no longer
  255. supported. You must now create a :class:`coverage.Coverage` object, and use
  256. methods on it.
  257. - The ``Coverage.use_cache`` method is no longer supported.
  258. - The private method ``Coverage._harvest_data`` is now called
  259. :meth:`Coverage.get_data`, and returns the :class:`CoverageData` containing
  260. the collected data.
  261. - Coverage.py is now licensed under the Apache 2.0 license. See `NOTICE.txt`_
  262. for details.
  263. - Coverage.py kits no longer include tests and docs. If you were using them,
  264. get in touch and let me know how.
  265. .. _NOTICE.txt: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
  266. Major new features:
  267. - Plugins: third parties can write plugins to add file support for non-Python
  268. files, such as web application templating engines, or languages that compile
  269. down to Python. See :ref:`plugins` for how to use plugins, and
  270. :ref:`api_plugin` for details of how to write them. A plugin for measuring
  271. Django template coverage is available: `django_coverage_plugin`_
  272. - Gevent, eventlet, and greenlet are now supported. The ``[run] concurrency``
  273. setting, or the ``--concurrency`` command line switch, specifies the
  274. concurrency library in use. Huge thanks to Peter Portante for initial
  275. implementation, and to Joe Jevnik for the final insight that completed the
  276. work.
  277. - The data storage has been re-written, using JSON instead of pickle. The
  278. :class:`.CoverageData` class is a new supported API to the contents of the
  279. data file. Data files from older versions of coverage.py can be converted to
  280. the new format with ``python -m coverage.pickle2json``.
  281. - Wildly experimental: support for measuring processes started by the
  282. multiprocessing module. To use, set ``--concurrency=multiprocessing``,
  283. either on the command line or in the .coveragerc file. Thanks, Eduardo
  284. Schettino. Currently, this does not work on Windows.
  285. New features:
  286. - Options are now also read from a setup.cfg file, if any. Sections are
  287. prefixed with "coverage:", so the ``[run]`` options will be read from the
  288. ``[coverage:run]`` section of setup.cfg.
  289. - The HTML report now has filtering. Type text into the Filter box on the
  290. index page, and only modules with that text in the name will be shown.
  291. Thanks, Danny Allen.
  292. - A new option: ``coverage report --skip-covered`` (or ``[report] skip_covered``)
  293. will reduce the number of files reported by skipping files with 100%
  294. coverage. Thanks, Krystian Kichewko. This means that empty ``__init__.py``
  295. files will be skipped, since they are 100% covered.
  296. - You can now specify the ``--fail-under`` option in the ``.coveragerc`` file
  297. as the ``[report] fail_under`` option.
  298. - The ``report -m`` command now shows missing branches when reporting on branch
  299. coverage. Thanks, Steve Leonard.
  300. - The ``coverage combine`` command now accepts any number of directories or
  301. files as arguments, and will combine all the data from them. This means you
  302. don't have to copy the files to one directory before combining. Thanks,
  303. Christine Lytwynec.
  304. - A new configuration option for the XML report: ``[xml] package_depth``
  305. controls which directories are identified as packages in the report.
  306. Directories deeper than this depth are not reported as packages.
  307. The default is that all directories are reported as packages.
  308. Thanks, Lex Berezhny.
  309. - A new configuration option, ``[run] note``, lets you set a note that will be
  310. stored in the ``runs`` section of the data file. You can use this to
  311. annotate the data file with any information you like.
  312. - The COVERAGE_DEBUG environment variable can be used to set the ``[run] debug``
  313. configuration option to control what internal operations are logged.
  314. - A new version identifier is available, `coverage.version_info`, a plain tuple
  315. of values similar to `sys.version_info`_.
  316. Improvements:
  317. - Coverage.py now always adds the current directory to sys.path, so that
  318. plugins can import files in the current directory.
  319. - Coverage.py now accepts a directory name for ``coverage run`` and will run a
  320. ``__main__.py`` found there, just like Python will. Thanks, Dmitry Trofimov.
  321. - The ``--debug`` switch can now be used on any command.
  322. - Reports now use file names with extensions. Previously, a report would
  323. describe a/b/c.py as "a/b/c". Now it is shown as "a/b/c.py". This allows
  324. for better support of non-Python files.
  325. - Missing branches in the HTML report now have a bit more information in the
  326. right-hand annotations. Hopefully this will make their meaning clearer.
  327. - The XML report now contains a <source> element. Thanks Stan Hu.
  328. - The XML report now includes a ``missing-branches`` attribute. Thanks, Steve
  329. Peak. This is not a part of the Cobertura DTD, so the XML report no longer
  330. references the DTD.
  331. - The XML report now reports each directory as a package again. This was a bad
  332. regression, I apologize.
  333. - In parallel mode, ``coverage erase`` will now delete all of the data files.
  334. - A new warning is possible, if a desired file isn't measured because it was
  335. imported before coverage.py was started.
  336. - The :func:`coverage.process_startup` function now will start coverage
  337. measurement only once, no matter how many times it is called. This fixes
  338. problems due to unusual virtualenv configurations.
  339. - Unrecognized configuration options will now print an error message and stop
  340. coverage.py. This should help prevent configuration mistakes from passing
  341. silently.
  342. API changes:
  343. - The class defined in the coverage module is now called ``Coverage`` instead
  344. of ``coverage``, though the old name still works, for backward compatibility.
  345. - You can now programmatically adjust the configuration of coverage.py by
  346. calling :meth:`Coverage.set_option` after construction.
  347. :meth:`Coverage.get_option` reads the configuration values.
  348. - If the `config_file` argument to the Coverage constructor is specified as
  349. ".coveragerc", it is treated as if it were True. This means setup.cfg is
  350. also examined, and a missing file is not considered an error.
  351. Bug fixes:
  352. - The textual report and the HTML report used to report partial branches
  353. differently for no good reason. Now the text report's "missing branches"
  354. column is a "partial branches" column so that both reports show the same
  355. numbers. This closes `issue 342`_.
  356. - The ``fail-under`` value is now rounded the same as reported results,
  357. preventing paradoxical results, fixing `issue 284`_.
  358. - Branch coverage couldn't properly handle certain extremely long files. This
  359. is now fixed, closing `issue 359`_.
  360. - Branch coverage didn't understand yield statements properly. Mickie Betz
  361. persisted in pursuing this despite Ned's pessimism. Fixes `issue 308`_ and
  362. `issue 324`_.
  363. - Files with incorrect encoding declaration comments are no longer ignored by
  364. the reporting commands.
  365. - Empty files are now reported as 100% covered in the XML report, not 0%
  366. covered.
  367. - The XML report will now create the output directory if need be. Thanks, Chris
  368. Rose.
  369. - HTML reports no longer raise UnicodeDecodeError if a Python file has
  370. undecodable characters.
  371. - The annotate command will now annotate all files, not just ones relative to
  372. the current directory.
  373. .. _django_coverage_plugin: https://pypi.python.org/pypi/django_coverage_plugin
  374. .. _issue 284: https://bitbucket.org/ned/coveragepy/issue/284/fail-under-should-show-more-precision
  375. .. _issue 308: https://bitbucket.org/ned/coveragepy/issue/308/yield-lambda-branch-coverage
  376. .. _issue 324: https://bitbucket.org/ned/coveragepy/issue/324/yield-in-loop-confuses-branch-coverage
  377. .. _issue 342: https://bitbucket.org/ned/coveragepy/issue/342/console-and-html-coverage-reports-differ
  378. .. _issue 359: https://bitbucket.org/ned/coveragepy/issue/359/xml-report-chunk-error
  379. .. _sys.version_info: https://docs.python.org/3/library/sys.html#sys.version_info
  380. .. _changes_371:
  381. Version 3.7.1 --- 2013-12-13
  382. ----------------------------
  383. - Improved the speed of HTML report generation by about 20%.
  384. - Fixed the mechanism for finding OS-installed static files for the HTML report
  385. so that it will actually find OS-installed static files.
  386. .. _changes_37:
  387. Version 3.7 --- 2013-10-06
  388. --------------------------
  389. - Added the ``--debug`` switch to ``coverage run``. It accepts a list of
  390. options indicating the type of internal activity to log to stderr. For
  391. details, see :ref:`the run --debug options <cmd_run_debug>`.
  392. - Improved the branch coverage facility, fixing `issue 92`_ and `issue 175`_.
  393. - Running code with ``coverage run -m`` now behaves more like Python does,
  394. setting sys.path properly, which fixes `issue 207`_ and `issue 242`_.
  395. - Coverage.py can now run .pyc files directly, closing `issue 264`_.
  396. - Coverage.py properly supports .pyw files, fixing `issue 261`_.
  397. - Omitting files within a tree specified with the ``source`` option would
  398. cause them to be incorrectly marked as unexecuted, as described in
  399. `issue 218`_. This is now fixed.
  400. - When specifying paths to alias together during data combining, you can now
  401. specify relative paths, fixing `issue 267`_.
  402. - Most file paths can now be specified with username expansion (``~/src``, or
  403. ``~build/src``, for example), and with environment variable expansion
  404. (``build/$BUILDNUM/src``).
  405. - Trying to create an XML report with no files to report on, would cause a
  406. ZeroDivideError, but no longer does, fixing `issue 250`_.
  407. - When running a threaded program under the Python tracer, coverage.py no
  408. longer issues a spurious warning about the trace function changing: "Trace
  409. function changed, measurement is likely wrong: None." This fixes
  410. `issue 164`_.
  411. - Static files necessary for HTML reports are found in system-installed places,
  412. to ease OS-level packaging of coverage.py. Closes `issue 259`_.
  413. - Source files with encoding declarations, but a blank first line, were not
  414. decoded properly. Now they are. Thanks, Roger Hu.
  415. - The source kit now includes the ``__main__.py`` file in the root coverage
  416. directory, fixing `issue 255`_.
  417. .. _issue 92: https://bitbucket.org/ned/coveragepy/issue/92/finally-clauses-arent-treated-properly-in
  418. .. _issue 164: https://bitbucket.org/ned/coveragepy/issue/164/trace-function-changed-warning-when-using
  419. .. _issue 175: https://bitbucket.org/ned/coveragepy/issue/175/branch-coverage-gets-confused-in-certain
  420. .. _issue 207: https://bitbucket.org/ned/coveragepy/issue/207/run-m-cannot-find-module-or-package-in
  421. .. _issue 242: https://bitbucket.org/ned/coveragepy/issue/242/running-a-two-level-package-doesnt-work
  422. .. _issue 218: https://bitbucket.org/ned/coveragepy/issue/218/run-command-does-not-respect-the-omit-flag
  423. .. _issue 250: https://bitbucket.org/ned/coveragepy/issue/250/uncaught-zerodivisionerror-when-generating
  424. .. _issue 255: https://bitbucket.org/ned/coveragepy/issue/255/directory-level-__main__py-not-included-in
  425. .. _issue 259: https://bitbucket.org/ned/coveragepy/issue/259/allow-use-of-system-installed-third-party
  426. .. _issue 261: https://bitbucket.org/ned/coveragepy/issue/261/pyw-files-arent-reported-properly
  427. .. _issue 264: https://bitbucket.org/ned/coveragepy/issue/264/coverage-wont-run-pyc-files
  428. .. _issue 267: https://bitbucket.org/ned/coveragepy/issue/267/relative-path-aliases-dont-work
  429. .. _changes_36:
  430. Version 3.6 --- 2013-01-05
  431. --------------------------
  432. Features:
  433. - The **report**, **html**, and **xml** commands now accept a ``--fail-under``
  434. switch that indicates in the exit status whether the coverage percentage was
  435. less than a particular value. Closes `issue 139`_.
  436. - The reporting functions coverage.report(), coverage.html_report(), and
  437. coverage.xml_report() now all return a float, the total percentage covered
  438. measurement.
  439. - The HTML report's title can now be set in the configuration file, with the
  440. ``--title`` switch on the command line, or via the API.
  441. - Configuration files now support substitution of environment variables, using
  442. syntax like ``${WORD}``. Closes `issue 97`_.
  443. Packaging:
  444. - The C extension is optionally compiled using a different more widely-used
  445. technique, taking another stab at fixing `issue 80`_ once and for all.
  446. - When installing, now in addition to creating a "coverage" command, two new
  447. aliases are also installed. A "coverage2" or "coverage3" command will be
  448. created, depending on whether you are installing in Python 2.x or 3.x.
  449. A "coverage-X.Y" command will also be created corresponding to your specific
  450. version of Python. Closes `issue 111`_.
  451. - The coverage.py installer no longer tries to bootstrap setuptools or
  452. Distribute. You must have one of them installed first, as `issue 202`_
  453. recommended.
  454. - The coverage.py kit now includes docs (closing `issue 137`_) and tests.
  455. Docs:
  456. - Added a page to the docs about :doc:`contributing <contributing>` to
  457. coverage.py, closing `issue 171`_.
  458. - Added a page to the docs about :doc:`troublesome situations <trouble>`,
  459. closing `issue 226`_.
  460. - Docstrings for the legacy singleton methods are more helpful. Thanks Marius
  461. Gedminas. Closes `issue 205`_.
  462. - The pydoc tool can now show documentation for the class `coverage.coverage`.
  463. Closes `issue 206`_.
  464. - Added some info to the TODO file, closing `issue 227`_.
  465. Fixes:
  466. - Wildcards in ``include=`` and ``omit=`` arguments were not handled properly
  467. in reporting functions, though they were when running. Now they are handled
  468. uniformly, closing `issue 143`_ and `issue 163`_. **NOTE**: it is possible
  469. that your configurations may now be incorrect. If you use ``include`` or
  470. ``omit`` during reporting, whether on the command line, through the API, or
  471. in a configuration file, please check carefully that you were not relying on
  472. the old broken behavior.
  473. - Embarrassingly, the `[xml] output=` setting in the .coveragerc file simply
  474. didn't work. Now it does.
  475. - Combining data files would create entries for phantom files if used with
  476. ``source`` and path aliases. It no longer does.
  477. - ``debug sys`` now shows the configuration file path that was read.
  478. - If an oddly-behaved package claims that code came from an empty-string
  479. file name, coverage.py no longer associates it with the directory name,
  480. fixing `issue 221`_.
  481. - The XML report now consistently uses file names for the filename attribute,
  482. rather than sometimes using module names. Fixes `issue 67`_.
  483. Thanks, Marcus Cobden.
  484. - Coverage percentage metrics are now computed slightly differently under
  485. branch coverage. This means that completely unexecuted files will now
  486. correctly have 0% coverage, fixing `issue 156`_. This also means that your
  487. total coverage numbers will generally now be lower if you are measuring
  488. branch coverage.
  489. - On Windows, files are now reported in their correct case, fixing `issue 89`_
  490. and `issue 203`_.
  491. - If a file is missing during reporting, the path shown in the error message
  492. is now correct, rather than an incorrect path in the current directory.
  493. Fixes `issue 60`_.
  494. - Running an HTML report in Python 3 in the same directory as an old Python 2
  495. HTML report would fail with a UnicodeDecodeError. This issue (`issue 193`_)
  496. is now fixed.
  497. - Fixed yet another error trying to parse non-Python files as Python, this
  498. time an IndentationError, closing `issue 82`_ for the fourth time...
  499. - If `coverage xml` fails because there is no data to report, it used to
  500. create a zero-length XML file. Now it doesn't, fixing `issue 210`_.
  501. - Jython files now work with the ``--source`` option, fixing `issue 100`_.
  502. - Running coverage.py under a debugger is unlikely to work, but it shouldn't
  503. fail with "TypeError: 'NoneType' object is not iterable". Fixes
  504. `issue 201`_.
  505. - On some Linux distributions, when installed with the OS package manager,
  506. coverage.py would report its own code as part of the results. Now it won't,
  507. fixing `issue 214`_, though this will take some time to be repackaged by the
  508. operating systems.
  509. - When coverage.py ended unsuccessfully, it may have reported odd errors like
  510. ``'NoneType' object has no attribute 'isabs'``. It no longer does,
  511. so kiss `issue 153`_ goodbye.
  512. .. _issue 60: https://bitbucket.org/ned/coveragepy/issue/60/incorrect-path-to-orphaned-pyc-files
  513. .. _issue 67: https://bitbucket.org/ned/coveragepy/issue/67/xml-report-filenames-may-be-generated
  514. .. _issue 80: https://bitbucket.org/ned/coveragepy/issue/80/is-there-a-duck-typing-way-to-know-we-cant
  515. .. _issue 89: https://bitbucket.org/ned/coveragepy/issue/89/on-windows-all-packages-are-reported-in
  516. .. _issue 97: https://bitbucket.org/ned/coveragepy/issue/97/allow-environment-variables-to-be
  517. .. _issue 100: https://bitbucket.org/ned/coveragepy/issue/100/source-directive-doesnt-work-for-packages
  518. .. _issue 111: https://bitbucket.org/ned/coveragepy/issue/111/when-installing-coverage-with-pip-not
  519. .. _issue 137: https://bitbucket.org/ned/coveragepy/issue/137/provide-docs-with-source-distribution
  520. .. _issue 139: https://bitbucket.org/ned/coveragepy/issue/139/easy-check-for-a-certain-coverage-in-tests
  521. .. _issue 143: https://bitbucket.org/ned/coveragepy/issue/143/omit-doesnt-seem-to-work-in-coverage
  522. .. _issue 153: https://bitbucket.org/ned/coveragepy/issue/153/non-existent-filename-triggers
  523. .. _issue 156: https://bitbucket.org/ned/coveragepy/issue/156/a-completely-unexecuted-file-shows-14
  524. .. _issue 163: https://bitbucket.org/ned/coveragepy/issue/163/problem-with-include-and-omit-filename
  525. .. _issue 171: https://bitbucket.org/ned/coveragepy/issue/171/how-to-contribute-and-run-tests
  526. .. _issue 193: https://bitbucket.org/ned/coveragepy/issue/193/unicodedecodeerror-on-htmlpy
  527. .. _issue 201: https://bitbucket.org/ned/coveragepy/issue/201/coverage-using-django-14-with-pydb-on
  528. .. _issue 202: https://bitbucket.org/ned/coveragepy/issue/202/get-rid-of-ez_setuppy-and
  529. .. _issue 203: https://bitbucket.org/ned/coveragepy/issue/203/duplicate-filenames-reported-when-filename
  530. .. _issue 205: https://bitbucket.org/ned/coveragepy/issue/205/make-pydoc-coverage-more-friendly
  531. .. _issue 206: https://bitbucket.org/ned/coveragepy/issue/206/pydoc-coveragecoverage-fails-with-an-error
  532. .. _issue 210: https://bitbucket.org/ned/coveragepy/issue/210/if-theres-no-coverage-data-coverage-xml
  533. .. _issue 214: https://bitbucket.org/ned/coveragepy/issue/214/coveragepy-measures-itself-on-precise
  534. .. _issue 221: https://bitbucket.org/ned/coveragepy/issue/221/coveragepy-incompatible-with-pyratemp
  535. .. _issue 226: https://bitbucket.org/ned/coveragepy/issue/226/make-readme-section-to-describe-when
  536. .. _issue 227: https://bitbucket.org/ned/coveragepy/issue/227/update-todo
  537. .. _changes_353:
  538. Version 3.5.3 --- 2012-09-29
  539. ----------------------------
  540. - Line numbers in the HTML report line up better with the source lines, fixing
  541. `issue 197`_, thanks Marius Gedminas.
  542. - When specifying a directory as the source= option, the directory itself no
  543. longer needs to have a ``__init__.py`` file, though its sub-directories do,
  544. to be considered as source files.
  545. - Files encoded as UTF-8 with a BOM are now properly handled, fixing
  546. `issue 179`_. Thanks, Pablo Carballo.
  547. - Fixed more cases of non-Python files being reported as Python source, and
  548. then not being able to parse them as Python. Closes `issue 82`_ (again).
  549. Thanks, Julian Berman.
  550. - Fixed memory leaks under Python 3, thanks, Brett Cannon. Closes `issue 147`_.
  551. - Optimized .pyo files may not have been handled correctly, `issue 195`_.
  552. Thanks, Marius Gedminas.
  553. - Certain unusually named file paths could have been mangled during reporting,
  554. `issue 194`_. Thanks, Marius Gedminas.
  555. - Try to do a better job of the impossible task of detecting when we can't
  556. build the C extension, fixing `issue 183`_.
  557. .. _issue 147: https://bitbucket.org/ned/coveragepy/issue/147/massive-memory-usage-by-ctracer
  558. .. _issue 179: https://bitbucket.org/ned/coveragepy/issue/179/htmlreporter-fails-when-source-file-is
  559. .. _issue 183: https://bitbucket.org/ned/coveragepy/issue/183/install-fails-for-python-23
  560. .. _issue 194: https://bitbucket.org/ned/coveragepy/issue/194/filelocatorrelative_filename-could-mangle
  561. .. _issue 195: https://bitbucket.org/ned/coveragepy/issue/195/pyo-file-handling-in-codeunit
  562. .. _issue 197: https://bitbucket.org/ned/coveragepy/issue/197/line-numbers-in-html-report-do-not-align
  563. .. _changes_352:
  564. Version 3.5.2 --- 2012-05-04
  565. ----------------------------
  566. - The HTML report has slightly tweaked controls: the buttons at the top of
  567. the page are color-coded to the source lines they affect.
  568. - Custom CSS can be applied to the HTML report by specifying a CSS file as
  569. the extra_css configuration value in the [html] section.
  570. - Source files with custom encodings declared in a comment at the top are now
  571. properly handled during reporting on Python 2. Python 3 always handled them
  572. properly. This fixes `issue 157`_.
  573. - Backup files left behind by editors are no longer collected by the source=
  574. option, fixing `issue 168`_.
  575. - If a file doesn't parse properly as Python, we don't report it as an error
  576. if the file name seems like maybe it wasn't meant to be Python. This is a
  577. pragmatic fix for `issue 82`_.
  578. - The ``-m`` switch on ``coverage report``, which includes missing line numbers
  579. in the summary report, can now be specified as ``show_missing`` in the
  580. config file. Closes `issue 173`_.
  581. - When running a module with ``coverage run -m <modulename>``, certain details
  582. of the execution environment weren't the same as for
  583. ``python -m <modulename>``. This had the unfortunate side-effect of making
  584. ``coverage run -m unittest discover`` not work if you had tests in a
  585. directory named "test". This fixes `issue 155`_.
  586. - Now the exit status of your product code is properly used as the process
  587. status when running ``python -m coverage run ...``. Thanks, JT Olds.
  588. - When installing into pypy, we no longer attempt (and fail) to compile
  589. the C tracer function, closing `issue 166`_.
  590. .. _issue 82: https://bitbucket.org/ned/coveragepy/issue/82/tokenerror-when-generating-html-report
  591. .. _issue 155: https://bitbucket.org/ned/coveragepy/issue/155/cant-use-coverage-run-m-unittest-discover
  592. .. _issue 157: https://bitbucket.org/ned/coveragepy/issue/157/chokes-on-source-files-with-non-utf-8
  593. .. _issue 166: https://bitbucket.org/ned/coveragepy/issue/166/dont-try-to-compile-c-extension-on-pypy
  594. .. _issue 168: https://bitbucket.org/ned/coveragepy/issue/168/dont-be-alarmed-by-emacs-droppings
  595. .. _issue 173: https://bitbucket.org/ned/coveragepy/issue/173/theres-no-way-to-specify-show-missing-in
  596. .. _changes_351:
  597. Version 3.5.1 --- 2011-09-23
  598. ----------------------------
  599. - When combining data files from parallel runs, you can now instruct
  600. coverage.py about which directories are equivalent on different machines. A
  601. ``[paths]`` section in the configuration file lists paths that are to be
  602. considered equivalent. Finishes `issue 17`_.
  603. - for-else constructs are understood better, and don't cause erroneous partial
  604. branch warnings. Fixes `issue 122`_.
  605. - Branch coverage for ``with`` statements is improved, fixing `issue 128`_.
  606. - The number of partial branches reported on the HTML summary page was
  607. different than the number reported on the individual file pages. This is
  608. now fixed.
  609. - An explicit include directive to measure files in the Python installation
  610. wouldn't work because of the standard library exclusion. Now the include
  611. directive takes precedence, and the files will be measured. Fixes
  612. `issue 138`_.
  613. - The HTML report now handles Unicode characters in Python source files
  614. properly. This fixes `issue 124`_ and `issue 144`_. Thanks, Devin
  615. Jeanpierre.
  616. - In order to help the core developers measure the test coverage of the
  617. standard library, Brandon Rhodes devised an aggressive hack to trick Python
  618. into running some coverage.py code before anything else in the process.
  619. See the coverage/fullcoverage directory if you are interested.
  620. .. _issue 17: http://bitbucket.org/ned/coveragepy/issue/17/support-combining-coverage-data-from
  621. .. _issue 122: http://bitbucket.org/ned/coveragepy/issue/122/for-else-always-reports-missing-branch
  622. .. _issue 124: http://bitbucket.org/ned/coveragepy/issue/124/no-arbitrary-unicode-in-html-reports-in
  623. .. _issue 128: http://bitbucket.org/ned/coveragepy/issue/128/branch-coverage-of-with-statement-in-27
  624. .. _issue 138: http://bitbucket.org/ned/coveragepy/issue/138/include-should-take-precedence-over-is
  625. .. _issue 144: http://bitbucket.org/ned/coveragepy/issue/144/failure-generating-html-output-for
  626. .. _changes_35:
  627. Version 3.5 --- 2011-06-29
  628. --------------------------
  629. HTML reporting:
  630. - The HTML report now has hotkeys. Try ``n``, ``s``, ``m``, ``x``, ``b``,
  631. ``p``, and ``c`` on the overview page to change the column sorting.
  632. On a file page, ``r``, ``m``, ``x``, and ``p`` toggle the run, missing,
  633. excluded, and partial line markings. You can navigate the highlighted
  634. sections of code by using the ``j`` and ``k`` keys for next and previous.
  635. The ``1`` (one) key jumps to the first highlighted section in the file,
  636. and ``0`` (zero) scrolls to the top of the file.
  637. - HTML reporting is now incremental: a record is kept of the data that
  638. produced the HTML reports, and only files whose data has changed will
  639. be generated. This should make most HTML reporting faster.
  640. Running Python files
  641. - Modules can now be run directly using ``coverage run -m modulename``, to
  642. mirror Python's ``-m`` flag. Closes `issue 95`_, thanks, Brandon Rhodes.
  643. - ``coverage run`` didn't emulate Python accurately in one detail: the
  644. current directory inserted into ``sys.path`` was relative rather than
  645. absolute. This is now fixed.
  646. - Pathological code execution could disable the trace function behind our
  647. backs, leading to incorrect code measurement. Now if this happens,
  648. coverage.py will issue a warning, at least alerting you to the problem.
  649. Closes `issue 93`_. Thanks to Marius Gedminas for the idea.
  650. - The C-based trace function now behaves properly when saved and restored
  651. with ``sys.gettrace()`` and ``sys.settrace()``. This fixes `issue 125`_
  652. and `issue 123`_. Thanks, Devin Jeanpierre.
  653. - Coverage.py can now be run directly from a working tree by specifying
  654. the directory name to python: ``python coverage_py_working_dir run ...``.
  655. Thanks, Brett Cannon.
  656. - A little bit of Jython support: `coverage run` can now measure Jython
  657. execution by adapting when $py.class files are traced. Thanks, Adi Roiban.
  658. Reporting
  659. - Partial branch warnings can now be pragma'd away. The configuration option
  660. ``partial_branches`` is a list of regular expressions. Lines matching any of
  661. those expressions will never be marked as a partial branch. In addition,
  662. there's a built-in list of regular expressions marking statements which should
  663. never be marked as partial. This list includes ``while True:``, ``while 1:``,
  664. ``if 1:``, and ``if 0:``.
  665. - The ``--omit`` and ``--include`` switches now interpret their values more
  666. usefully. If the value starts with a wildcard character, it is used as-is.
  667. If it does not, it is interpreted relative to the current directory.
  668. Closes `issue 121`_.
  669. - Syntax errors in supposed Python files can now be ignored during reporting
  670. with the ``-i`` switch just like other source errors. Closes `issue 115`_.
  671. .. _issue 93: http://bitbucket.org/ned/coveragepy/issue/93/copying-a-mock-object-breaks-coverage
  672. .. _issue 95: https://bitbucket.org/ned/coveragepy/issue/95/run-subcommand-should-take-a-module-name
  673. .. _issue 115: https://bitbucket.org/ned/coveragepy/issue/115/fail-gracefully-when-reporting-on-file
  674. .. _issue 121: https://bitbucket.org/ned/coveragepy/issue/121/filename-patterns-are-applied-stupidly
  675. .. _issue 123: https://bitbucket.org/ned/coveragepy/issue/123/pyeval_settrace-used-in-way-that-breaks
  676. .. _issue 125: https://bitbucket.org/ned/coveragepy/issue/125/coverage-removes-decoratortoolss-tracing
  677. .. _changes_34:
  678. Version 3.4 --- 2010-09-19
  679. --------------------------
  680. Controlling source:
  681. - BACKWARD INCOMPATIBILITY: the ``--omit`` and ``--include`` switches now take
  682. file patterns rather than file prefixes, closing `issue 34`_ and `issue 36`_.
  683. - BACKWARD INCOMPATIBILITY: the `omit_prefixes` argument is gone throughout
  684. coverage.py, replaced with `omit`, a list of file name patterns suitable for
  685. `fnmatch`. A parallel argument `include` controls what files are included.
  686. - The run command now has a ``--source`` switch, a list of directories or
  687. module names. If provided, coverage.py will only measure execution in those
  688. source files. The run command also now supports ``--include`` and ``--omit``
  689. to control what modules it measures. This can speed execution and reduce the
  690. amount of data during reporting. Thanks Zooko.
  691. - The reporting commands (report, annotate, html, and xml) now have an
  692. ``--include`` switch to restrict reporting to modules matching those file
  693. patterns, similar to the existing ``--omit`` switch. Thanks, Zooko.
  694. Reporting:
  695. - Completely unexecuted files can now be included in coverage results, reported
  696. as 0% covered. This only happens if the --source option is specified, since
  697. coverage.py needs guidance about where to look for source files.
  698. - Python files with no statements, for example, empty ``__init__.py`` files,
  699. are now reported as having zero statements instead of one. Fixes `issue 1`_.
  700. - Reports now have a column of missed line counts rather than executed line
  701. counts, since developers should focus on reducing the missed lines to zero,
  702. rather than increasing the executed lines to varying targets. Once
  703. suggested, this seemed blindingly obvious.
  704. - Coverage percentages are now displayed uniformly across reporting methods.
  705. Previously, different reports could round percentages differently. Also,
  706. percentages are only reported as 0% or 100% if they are truly 0 or 100, and
  707. are rounded otherwise. Fixes `issue 41`_ and `issue 70`_.
  708. - The XML report output now properly includes a percentage for branch coverage,
  709. fixing `issue 65`_ and `issue 81`_, and the report is sorted by package
  710. name, fixing `issue 88`_.
  711. - The XML report is now sorted by package name, fixing `issue 88`_.
  712. - The precision of reported coverage percentages can be set with the
  713. ``[report] precision`` config file setting. Completes `issue 16`_.
  714. - Line numbers in HTML source pages are clickable, linking directly to that
  715. line, which is highlighted on arrival. Added a link back to the index page
  716. at the bottom of each HTML page.
  717. Execution and measurement:
  718. - Various warnings are printed to stderr for problems encountered during data
  719. measurement: if a ``--source`` module has no Python source to measure, or is
  720. never encountered at all, or if no data is collected.
  721. - Doctest text files are no longer recorded in the coverage data, since they
  722. can't be reported anyway. Fixes `issue 52`_ and `issue 61`_.
  723. - Threads derived from ``threading.Thread`` with an overridden `run` method
  724. would report no coverage for the `run` method. This is now fixed, closing
  725. `issue 85`_.
  726. - Programs that exited with ``sys.exit()`` with no argument weren't handled
  727. properly, producing a coverage.py stack trace. This is now fixed.
  728. - Programs that call ``os.fork`` will properly collect data from both the child
  729. and parent processes. Use ``coverage run -p`` to get two data files that can
  730. be combined with ``coverage combine``. Fixes `issue 56`_.
  731. - When measuring code running in a virtualenv, most of the system library was
  732. being measured when it shouldn't have been. This is now fixed.
  733. - Coverage.py can now be run as a module: ``python -m coverage``. Thanks,
  734. Brett Cannon.
  735. .. _issue 1: http://bitbucket.org/ned/coveragepy/issue/1/empty-__init__py-files-are-reported-as-1-executable
  736. .. _issue 16: http://bitbucket.org/ned/coveragepy/issue/16/allow-configuration-of-accuracy-of-percentage-totals
  737. .. _issue 34: http://bitbucket.org/ned/coveragepy/issue/34/enhanced-omit-globbing-handling
  738. .. _issue 36: http://bitbucket.org/ned/coveragepy/issue/36/provide-regex-style-omit
  739. .. _issue 41: http://bitbucket.org/ned/coveragepy/issue/41/report-says-100-when-it-isnt-quite-there
  740. .. _issue 52: http://bitbucket.org/ned/coveragepy/issue/52/doctesttestfile-confuses-source-detection
  741. .. _issue 56: http://bitbucket.org/ned/coveragepy/issue/56/coveragepy-cant-trace-child-processes-of-a
  742. .. _issue 61: http://bitbucket.org/ned/coveragepy/issue/61/annotate-i-doesnt-work
  743. .. _issue 65: http://bitbucket.org/ned/coveragepy/issue/65/branch-option-not-reported-in-cobertura
  744. .. _issue 70: http://bitbucket.org/ned/coveragepy/issue/70/text-report-and-html-report-disagree-on-coverage
  745. .. _issue 81: http://bitbucket.org/ned/coveragepy/issue/81/xml-report-does-not-have-condition-coverage-attribute-for-lines-with-a
  746. .. _issue 85: http://bitbucket.org/ned/coveragepy/issue/85/threadrun-isnt-measured
  747. .. _issue 88: http://bitbucket.org/ned/coveragepy/issue/88/xml-report-lists-packages-in-random-order
  748. .. _changes_331:
  749. Version 3.3.1 --- 2010-03-06
  750. ----------------------------
  751. - Using ``parallel=True`` in a .coveragerc file prevented reporting, but now
  752. does not, fixing `issue 49`_.
  753. - When running your code with ``coverage run``, if you call ``sys.exit()``,
  754. coverage.py will exit with that status code, fixing `issue 50`_.
  755. .. _issue 49: http://bitbucket.org/ned/coveragepy/issue/49
  756. .. _issue 50: http://bitbucket.org/ned/coveragepy/issue/50
  757. .. _changes_33:
  758. Version 3.3 --- 2010-02-24
  759. --------------------------
  760. - Settings are now read from a .coveragerc file. A specific file can be
  761. specified on the command line with ``--rcfile=FILE``. The name of the file
  762. can be programmatically set with the ``config_file`` argument to the
  763. coverage() constructor, or reading a config file can be disabled with
  764. ``config_file=False``.
  765. - Added coverage.process_start to enable coverage measurement when Python
  766. starts.
  767. - Parallel data file names now have a random number appended to them in
  768. addition to the machine name and process id. Also, parallel data files
  769. combined with ``coverage combine`` are deleted after they're combined, to
  770. clean up unneeded files. Fixes `issue 40`_.
  771. - Exceptions thrown from product code run with ``coverage run`` are now
  772. displayed without internal coverage.py frames, so the output is the same as
  773. when the code is run without coverage.py.
  774. - Fixed `issue 39`_ and `issue 47`_.
  775. .. _issue 39: http://bitbucket.org/ned/coveragepy/issue/39
  776. .. _issue 40: http://bitbucket.org/ned/coveragepy/issue/40
  777. .. _issue 47: http://bitbucket.org/ned/coveragepy/issue/47
  778. .. _changes_32:
  779. Version 3.2 --- 2009-12-05
  780. --------------------------
  781. - Branch coverage: coverage.py can tell you which branches didn't have both (or
  782. all) choices executed, even where the choice doesn't affect which lines were
  783. executed. See :ref:`branch` for more details.
  784. - The table of contents in the HTML report is now sortable: click the headers
  785. on any column. The sorting is persisted so that subsequent reports are
  786. sorted as you wish. Thanks, `Chris Adams`_.
  787. - XML reporting has file paths that let Cobertura find the source code, fixing
  788. `issue 21`_.
  789. - The ``--omit`` option now works much better than before, fixing `issue 14`_
  790. and `issue 33`_. Thanks, Danek Duvall.
  791. - Added a ``--version`` option on the command line.
  792. - Program execution under coverage.py is a few percent faster.
  793. - Some exceptions reported by the command line interface have been cleaned up
  794. so that tracebacks inside coverage.py aren't shown. Fixes `issue 23`_.
  795. - Fixed some problems syntax coloring sources with line continuations and
  796. source with tabs: `issue 30`_ and `issue 31`_.
  797. .. _Chris Adams: http://improbable.org/chris/
  798. .. _issue 21: http://bitbucket.org/ned/coveragepy/issue/21
  799. .. _issue 23: http://bitbucket.org/ned/coveragepy/issue/23
  800. .. _issue 14: http://bitbucket.org/ned/coveragepy/issue/14
  801. .. _issue 30: http://bitbucket.org/ned/coveragepy/issue/30
  802. .. _issue 31: http://bitbucket.org/ned/coveragepy/issue/31
  803. .. _issue 33: http://bitbucket.org/ned/coveragepy/issue/33
  804. .. _changes_31:
  805. Version 3.1 --- 2009-10-04
  806. --------------------------
  807. - Python 3.1 is now supported.
  808. - Coverage.py has a new command line syntax with sub-commands. This expands
  809. the possibilities for adding features and options in the future. The old
  810. syntax is still supported. Try ``coverage help`` to see the new commands.
  811. Thanks to Ben Finney for early help.
  812. - Added an experimental ``coverage xml`` command for producing coverage reports
  813. in a Cobertura-compatible XML format. Thanks, Bill Hart.
  814. - Added the ``--timid`` option to enable a simpler slower trace function that
  815. works for DecoratorTools projects, including TurboGears. Fixed `issue 12`_
  816. and `issue 13`_.
  817. - HTML reports now display syntax-colored Python source.
  818. - Added a ``coverage debug`` command for getting diagnostic information about
  819. the coverage.py installation.
  820. - Source code can now be read from eggs. Thanks, `Ross Lawley`_. Fixes
  821. `issue 25`_.
  822. .. _Ross Lawley: http://agileweb.org/
  823. .. _issue 25: http://bitbucket.org/ned/coveragepy/issue/25
  824. .. _issue 12: http://bitbucket.org/ned/coveragepy/issue/12
  825. .. _issue 13: http://bitbucket.org/ned/coveragepy/issue/13
  826. .. _changes_301:
  827. Version 3.0.1 --- 2009-07-07
  828. ----------------------------
  829. - Removed the recursion limit in the tracer function. Previously, code that
  830. ran more than 500 frames deep would crash.
  831. - Fixed a bizarre problem involving pyexpat, whereby lines following XML parser
  832. invocations could be overlooked.
  833. - On Python 2.3, coverage.py could mis-measure code with exceptions being
  834. raised. This is now fixed.
  835. - The coverage.py code itself will now not be measured by coverage.py, and no
  836. coverage.py modules will be mentioned in the nose ``--with-cover`` plugin.
  837. - When running source files, coverage.py now opens them in universal newline
  838. mode just like Python does. This lets it run Windows files on Mac, for
  839. example.
  840. .. _changes_30:
  841. Version 3.0 --- 2009-06-13
  842. --------------------------
  843. - Coverage.py is now a package rather than a module. Functionality has been
  844. split into classes.
  845. - HTML reports and annotation of source files: use the new ``-b`` (browser)
  846. switch. Thanks to George Song for code, inspiration and guidance.
  847. - The trace function is implemented in C for speed. Coverage.py runs are now
  848. much faster. Thanks to David Christian for productive micro-sprints and
  849. other encouragement.
  850. - The minimum supported Python version is 2.3.
  851. - When using the object API (that is, constructing a coverage() object), data
  852. is no longer saved automatically on process exit. You can re-enable it with
  853. the ``auto_data=True`` parameter on the coverage() constructor.
  854. The module-level interface still uses automatic saving.
  855. - Code in the Python standard library is not measured by default. If you need
  856. to measure standard library code, use the ``-L`` command-line switch during
  857. execution, or the ``cover_pylib=True`` argument to the coverage()
  858. constructor.
  859. - API changes:
  860. - Added parameters to coverage.__init__ for options that had been set on
  861. the coverage object itself.
  862. - Added clear_exclude() and get_exclude_list() methods for programmatic
  863. manipulation of the exclude regexes.
  864. - Added coverage.load() to read previously-saved data from the data file.
  865. - coverage.annotate_file is no longer available.
  866. - Removed the undocumented cache_file argument to coverage.usecache().