Skip to content

Commit 59b07a1

Browse files
committed
deprecated: the annotate command will be removed in a future version
1 parent 81a55d1 commit 59b07a1

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

CHANGES.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ This list is detailed and covers changes in each pre-release version.
2323
Unreleased
2424
----------
2525

26+
- Deprecated: The ``annotate`` command and the ``Coverage.annotate`` function
27+
will be removed in a future version, unless people let me know that they are
28+
using it. Get in touch if you do: [email protected].
29+
2630
- Feature: Coverage now sets an environment variable, ``COVERAGE_RUN`` when
2731
running your code with the ``coverage run`` command. The value is not
2832
important, and may change in the future. Closes `issue 553`_.
@@ -43,7 +47,7 @@ Unreleased
4347

4448
- Feature: Added support for PyPy 3.8.
4549

46-
- Fix: more generated code is now excluded from measurement. Code such as
50+
- Fix: More generated code is now excluded from measurement. Code such as
4751
`attrs`_ boilerplate, or doctest code, was being measured though the
4852
synthetic line numbers meant they were never reported. Once Cython was
4953
involved though, the generated .so files were parsed as Python, raising

coverage/control.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,11 @@ def annotate(
932932
):
933933
"""Annotate a list of modules.
934934
935+
.. note::
936+
This method has been obsoleted by more modern reporting tools,
937+
including the :meth:`html_report` method. It will be removed in a
938+
future version.
939+
935940
Each module in `morfs` is annotated. The source is written to a new
936941
file, named with a ",cover" suffix, with each line prefixed with a
937942
marker to indicate the coverage of the line. Covered lines have ">",
@@ -940,6 +945,9 @@ def annotate(
940945
See :meth:`report` for other arguments.
941946
942947
"""
948+
print("The annotate command will be removed in a future version.")
949+
print("Get in touch if you still use it: [email protected]")
950+
943951
with override_config(self,
944952
ignore_errors=ignore_errors, report_omit=omit,
945953
report_include=include, report_contexts=contexts,

doc/cmd.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,11 @@ Other common reporting options are described above in :ref:`cmd_reporting`.
511511
Text annotation: ``coverage annotate``
512512
--------------------------------------
513513

514+
.. note::
515+
The **annotate** command has been obsoleted by more modern reporting tools,
516+
including the **html** command. **annotate** will be removed in a future
517+
version.
518+
514519
The **annotate** command produces a text annotation of your source code. With
515520
a ``-d`` argument specifying an output directory, each Python file becomes a
516521
text file in that directory. Without ``-d``, the files are written into the

tests/test_annotate.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,10 @@ def f(x):
123123
cov = coverage.Coverage()
124124
self.start_import_stop(cov, "mae")
125125
cov.annotate()
126-
assert self.stdout() == "1\n2\n"
126+
assert self.stdout() == (
127+
"1\n" +
128+
"2\n" +
129+
"The annotate command will be removed in a future version.\n" +
130+
"Get in touch if you still use it: [email protected]\n"
131+
)
127132
compare(gold_path("annotate/mae"), ".", "*,cover")

0 commit comments

Comments
 (0)