diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py index 17ae7663b71..d5b90ce9371 100644 --- a/src/sage/doctest/forker.py +++ b/src/sage/doctest/forker.py @@ -1247,6 +1247,18 @@ def _failure_header(self, test, example, message='Failed example:', extra=None): Hello there! doctest_var = 42; doctest_var^2 + + TESTS: + + Test GitHub output format (used for GitHub Actions annotations):: + + sage: DTR.options.format = 'github' + sage: print(DTR._failure_header(doctests[0], ex)) + ********************************************************************** + ::error title=Failed example:,file=.../sage/doctest/forker.py,line=12::Failed example: + doctest_var = 42; doctest_var^2 + + sage: DTR.options.format = 'sage' """ out = [self.DIVIDER] with OriginalSource(example): diff --git a/src/sage/doctest/reporting.py b/src/sage/doctest/reporting.py index a05b47c85d8..0d18affa31a 100644 --- a/src/sage/doctest/reporting.py +++ b/src/sage/doctest/reporting.py @@ -254,6 +254,14 @@ def _log_failure(self, source, fail_msg, event, output=None): Tests run before process (pid=1234) timed out: Output so far... ********************************************************************** + + TESTS: + + Test GitHub output format (used for GitHub Actions annotations):: + + sage: DTR.controller.options.format = 'github' + sage: DTR._log_failure(FDS, "Timed out", "process (pid=1234) timed out", "Output so far...") + ::error title=Timed out,file=.../sage/doctest/reporting.py::Output so far... """ log = self.controller.log format = self.controller.options.format