Skip to content

Commit beadfb8

Browse files
committed
Docs docs docs docs docs
1 parent 7c83ebf commit beadfb8

6 files changed

Lines changed: 382 additions & 322 deletions

File tree

Doc/backup.db

4 KB
Binary file not shown.

Doc/dump.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BEGIN TRANSACTION;
2+
COMMIT;

Doc/example.db

Whitespace-only changes.

Doc/library/doctest.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@ Some details you should read once, but won't need to remember:
500500
everything following the leftmost colon and any module information in the
501501
exception name is ignored.
502502

503+
* When the :const:`IGNORE_EXCEPTION_TIMESTAMPS` doctest option is specified,
504+
timestamps of the formats that :envvar:`PYTHON_TRACEBACK_TIMESTAMPS`
505+
environment variable could append to exception messages are stripped from
506+
tracebacks generated by the code under test before comparison.
507+
503508
* The interactive shell omits the traceback header line for some
504509
:exc:`SyntaxError`\ s. But doctest uses the traceback header line to
505510
distinguish exceptions from non-exceptions. So in the rare case where you need
@@ -625,6 +630,22 @@ doctest decides whether actual output matches an example's expected output:
625630
to the module containing the exception under test.
626631

627632

633+
.. data:: IGNORE_EXCEPTION_TIMESTAMPS
634+
635+
When the :envvar:`PYTHON_TRACEBACK_TIMESTAMPS` environment variable is set,
636+
exception and warning messages rendered in tracebacks may have a timestamp
637+
value appended after the message. This strips all possible formats of that
638+
`` <@2025-02-08T01:21:28.675309>`` timestamp tag that may be appended to an
639+
exception message in generated tracebacks before comparing.
640+
641+
:const:`ELLIPSIS` and :const:`IGNORE_EXCEPTION_DETAIL` could also be used to
642+
avoid matching those. This can be cleaner when you need to test specific
643+
details of exception messages.
644+
645+
.. versionadded:: next
646+
:const:`IGNORE_EXCEPTION_TIMESTAMPS` was added.
647+
648+
628649
.. data:: SKIP
629650

630651
When specified, do not run the example at all. This can be useful in contexts

0 commit comments

Comments
 (0)