summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.rst11
-rw-r--r--coverage/cmdline.py2
-rw-r--r--doc/branch.rst4
-rw-r--r--doc/cmd.rst6
-rw-r--r--doc/config.rst20
5 files changed, 24 insertions, 19 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 539f8a09..5d0ff126 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,20 +20,23 @@ development at the same time, like 4.5.x and 5.0.
Unreleased
----------
+- Data can now be "reported" in JSON format, for programmatic use, as requested
+ in `issue 720`_. The new ``coverage json`` command writes raw and summarized
+ data to a JSON file. Thanks, Matt Bachmann.
+
- The compact line number representation introduced in 5.0a6 is called a
"numbits." The :mod:`coverage.numbits` module provides functions for working
with them.
-- A class named "test_something" no longer confuses the `test_function` dynamic
- context setting. Fixes `issue 829`_.
+- A class named "test_something" no longer confuses the ``test_function``
+ dynamic context setting. Fixes `issue 829`_.
- Fixed an unusual tokenizing issue with backslashes in comments. Fixes
`issue 822`_.
-- `debug=plugin` didn't properly support configuration or dynamic context
+- ``debug=plugin`` didn't properly support configuration or dynamic context
plugins, but now it does, closing `issue 834`_.
-- Added a JSON report `issue 720`_.
.. _issue 720: https://github.com/nedbat/coveragepy/issues/720
.. _issue 822: https://github.com/nedbat/coveragepy/issues/822
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index 78e90d45..2bec4ea8 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -125,7 +125,7 @@ class Opts(object):
)
json_pretty_print = optparse.make_option(
'', '--pretty-print', action='store_true',
- help="Print the json formatted for human readers",
+ help="Format the JSON for human readers",
)
parallel_mode = optparse.make_option(
'-p', '--parallel-mode', action='store_true',
diff --git a/doc/branch.rst b/doc/branch.rst
index 9af8f050..312b3a3a 100644
--- a/doc/branch.rst
+++ b/doc/branch.rst
@@ -56,8 +56,8 @@ that were missing some branches are shown in yellow, with an annotation at the
far right showing branch destination line numbers that were not exercised.
The XML and JSON reports produced by ``coverage xml`` and ``coverage json``
-respectively also include branch information, including separate statement and
-branch coverage percentages.
+also include branch information, including separate statement and branch
+coverage percentages.
How it works
diff --git a/doc/cmd.rst b/doc/cmd.rst
index ad84a6ae..1aca89a8 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -477,14 +477,16 @@ You can specify the name of the output file with the ``-o`` switch.
Other common reporting options are described above in :ref:`cmd_reporting`.
+
.. _cmd_json:
JSON reporting
--------------
+--------------
The **json** command writes coverage data to a "coverage.json" file.
-You can specify the name of the output file with the ``-o`` switch.
+You can specify the name of the output file with the ``-o`` switch. The JSON
+can be nicely formatted by specifying the ``--pretty-print`` switch.
Other common reporting options are described above in :ref:`cmd_reporting`.
diff --git a/doc/config.rst b/doc/config.rst
index 84c77131..43d5a27e 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -302,21 +302,21 @@ identified as packages in the report. Directories deeper than this depth are
not reported as packages. The default is that all directories are reported as
packages.
+
.. _config_json:
[json]
------
+------
-Values particular to json reporting. The values in the ``[report]`` section
+Values particular to JSON reporting. The values in the ``[report]`` section
also apply to JSON output, where appropriate.
-``json_output`` (string, default "coverage.json"): where to write the json
-report.
+``output`` (string, default "coverage.json"): where to write the JSON file.
-``json_pretty_print`` (boolean, default false): controls if fields in the json
-are outputted with whitespace formatted for human consumption (True) or for
-minimum file size (False)
+``pretty_print`` (boolean, default false): controls if the JSON is outputted
+with whitespace formatted for human consumption (True) or for minimum file size
+(False).
-``json_show_contexts`` (boolean, default false): should the json report include
-an indication on each line of which contexts executed the line.
-See :ref:`dynamic_contexts` for details.
+``show_contexts`` (boolean, default false): should the JSON report include an
+indication of which contexts executed each line. See :ref:`dynamic_contexts`
+for details.