Skip to content

Commit fa2a7ca

Browse files
committed
pythongh-117225: Document colour use in doctest
1 parent 5865fa5 commit fa2a7ca

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

Doc/using/cmdline.rst

+10-2
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,11 @@ behavior can be controlled by setting different environment variables.
632632

633633
Setting the environment variable ``TERM`` to ``dumb`` will disable color.
634634

635-
If the environment variable ``FORCE_COLOR`` is set, then color will be
635+
If the |FORCE_COLOR|_ environment variable is set, then color will be
636636
enabled regardless of the value of TERM. This is useful on CI systems which
637637
aren’t terminals but can still display ANSI escape sequences.
638638

639-
If the environment variable ``NO_COLOR`` is set, Python will disable all color
639+
If the |NO_COLOR|_ environment variable is set, Python will disable all color
640640
in the output. This takes precedence over ``FORCE_COLOR``.
641641

642642
All these environment variables are used also by other tools to control color
@@ -645,6 +645,14 @@ output. To control the color output only in the Python interpreter, the
645645
precedence over ``NO_COLOR``, which in turn takes precedence over
646646
``FORCE_COLOR``.
647647

648+
.. Apparently this how you hack together a formatted link:
649+
650+
.. |FORCE_COLOR| replace:: ``FORCE_COLOR``
651+
.. _FORCE_COLOR: https://force-color.org/
652+
653+
.. |NO_COLOR| replace:: ``NO_COLOR``
654+
.. _NO_COLOR: https://no-color.org/
655+
648656
Options you shouldn't use
649657
~~~~~~~~~~~~~~~~~~~~~~~~~
650658

Doc/whatsnew/3.13.rst

+15-1
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,18 @@ Improved Error Messages
100100

101101
* The interpreter now colorizes error messages when displaying tracebacks by default.
102102
This feature can be controlled via the new :envvar:`PYTHON_COLORS` environment
103-
variable as well as the canonical ``NO_COLOR`` and ``FORCE_COLOR`` environment
103+
variable as well as the canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment
104104
variables. See also :ref:`using-on-controlling-color`.
105105
(Contributed by Pablo Galindo Salgado in :gh:`112730`.)
106106

107+
.. Apparently this how you hack together a formatted link:
108+
109+
.. |FORCE_COLOR| replace:: ``FORCE_COLOR``
110+
.. _FORCE_COLOR: https://force-color.org/
111+
112+
.. |NO_COLOR| replace:: ``NO_COLOR``
113+
.. _NO_COLOR: https://no-color.org/
114+
107115
* A common mistake is to write a script with the same name as a
108116
standard library module. When this results in errors, we now
109117
display a more helpful error message:
@@ -437,6 +445,12 @@ doctest
437445
:attr:`doctest.TestResults.skipped` attributes.
438446
(Contributed by Victor Stinner in :gh:`108794`.)
439447

448+
* Color is added to the output by default.
449+
This can be controlled via the new :envvar:`PYTHON_COLORS` environment
450+
variable as well as the canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment
451+
variables. See also :ref:`using-on-controlling-color`.
452+
(Contributed by Hugo van Kemenade in :gh:`117225`.)
453+
440454
email
441455
-----
442456

0 commit comments

Comments
 (0)