Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage -t --format github (illustration) #36558

Closed
wants to merge 43 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7f982bb
.github/workflows/ci-conda-known-test-failures.json: Add random failu…
mkoeppe Dec 20, 2023
48cde67
src/sage/doctest/forker.py: Show '# [failed in baseline]' earlier
mkoeppe Dec 20, 2023
d52858c
Refactor through new function DocTestController.source_baseline
mkoeppe Dec 20, 2023
1849493
WIP
mkoeppe Dec 20, 2023
8aca1ad
sage -t: Add option '--format github'
mkoeppe Dec 21, 2023
72ac0ec
.github/workflows/build.yml: Use sage -t --format github
mkoeppe Dec 21, 2023
7a121e6
src/sage/doctest/control.py: Fix doctest
mkoeppe Dec 21, 2023
0bd0077
src/sage/doctest/control.py: Log 'Using --baseline-stats-path=...'
mkoeppe Dec 21, 2023
8c8f2dc
Merge branch 'doctester-baselinestats-improvement' into doctester-git…
mkoeppe Dec 21, 2023
24779a9
src/sage/doctest/forker.py: Rewrite without 'match'
mkoeppe Dec 21, 2023
ee0cb6b
.github/workflows/ci-conda-known-test-failures.json: Add https://gith…
mkoeppe Dec 21, 2023
fed6570
.github/workflows/ci-conda-known-test-failures.json: Add https://gith…
mkoeppe Dec 21, 2023
22ef486
.github/workflows/ci-conda-known-test-failures.json: Add some failure…
mkoeppe Dec 21, 2023
5fc07c7
src/bin/sage-runtests: Generalize argparse hack
mkoeppe Dec 21, 2023
93c4e7d
DocTestReporter.report_head: Move all printing of 'failed in baseline…
mkoeppe Dec 21, 2023
55eba9f
Merge branch 'doctester-baselinestats-improvement' into doctester-git…
mkoeppe Dec 21, 2023
0f35de8
Merge branch 'doctester-github-annotations--prod' into doctester-gith…
mkoeppe Dec 21, 2023
c05bdba
DocTestReporter.report_head: Move all printing of 'failed in baseline…
mkoeppe Dec 21, 2023
5d5f6c1
Merge branch 'doctester-baselinestats-improvement' into doctester-git…
mkoeppe Dec 21, 2023
c165172
Merge branch 'doctester-github-annotations--prod' into doctester-gith…
mkoeppe Dec 21, 2023
5e5d720
Merge branch 'doctester-baselinestats-improvement' into ci_conda_more…
mkoeppe Dec 21, 2023
179ebb4
.github/workflows/ci-conda-known-test-failures.json: Add references f…
mkoeppe Dec 21, 2023
b41999b
.github/workflows/ci-conda-known-test-failures.json: Add details from…
mkoeppe Dec 21, 2023
63b8b10
src/sage/doctest/reporting.py: Include message in '[failed in baselin…
mkoeppe Dec 21, 2023
4a22bbc
Merge branch 'ci_conda_more_known_failures' into doctester-github-ann…
mkoeppe Dec 21, 2023
4b0f525
.github/workflows/build.yml: Fix up path to coverage files
mkoeppe Dec 23, 2023
0bfd2c9
src/sage/doctest/reporting.py: Make 'AlarmInterrupt in doctesting fra…
mkoeppe Dec 23, 2023
f2d8abf
Merge branch 'doctester-baselinestats-improvement' into doctester-git…
mkoeppe Dec 23, 2023
ce3b849
.github/workflows/build.yml: Do not create GitHub Annotations for the…
mkoeppe Dec 28, 2023
2a540d8
Merge remote-tracking branch 'upstream/develop' into doctester-github…
mkoeppe Dec 28, 2023
b14e0f2
Merge branch 'doctester-github-annotations--prod' into doctester-gith…
mkoeppe Dec 28, 2023
b83dcf3
src/sage/doctest/forker.py: Use urllib.parse.quote for github annotat…
mkoeppe Dec 29, 2023
81768a3
Merge branch 'doctester-github-annotations--prod' into doctester-gith…
mkoeppe Dec 29, 2023
96e0431
src/sage/doctest/forker.py: Don't use urllib.parse.quote, only quote …
mkoeppe Dec 29, 2023
dda4dc3
Merge branch 'doctester-github-annotations--prod' into doctester-gith…
mkoeppe Dec 29, 2023
1d69f07
.github/workflows/build.yml: Fix "Couldn't combine from non-existent …
mkoeppe Dec 29, 2023
2cfcbe3
Merge remote-tracking branch 'upstream/develop' into doctester-github…
mkoeppe Jan 4, 2024
173bc41
.github/workflows/build.yml: Pass --rcfile to coverage
mkoeppe Jan 5, 2024
d27f1ca
Merge branch 'doctester-github-annotations--prod' into doctester-gith…
mkoeppe Jan 5, 2024
4ecf7ca
src/tox.ini (coverage:report): Ignore errors, ignore empty
mkoeppe Jan 5, 2024
aa344d2
Merge branch 'doctester-github-annotations--prod' into doctester-gith…
mkoeppe Jan 5, 2024
6aa76c0
Merge remote-tracking branch 'upstream/develop' into doctester-github…
mkoeppe Jan 14, 2024
e8ef307
Merge branch 'doctester-github-annotations--prod' into doctester-gith…
mkoeppe Jan 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
src/sage/doctest/forker.py: Use urllib.parse.quote for github annotat…
…ions
  • Loading branch information
Matthias Koeppe committed Dec 29, 2023
commit b83dcf3102dd1b8a6d5c869895c4a80c9379e9aa
19 changes: 12 additions & 7 deletions src/sage/doctest/forker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1248,16 +1248,21 @@ def _failure_header(self, test, example, message='Failed example:'):
out.append(message)
elif self.options.format == 'github':
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#using-workflow-commands-to-access-toolkit-functions
from urllib.parse import quote

def q(string):
return quote(string, safe=' /,"\'')

if message.startswith('Warning: '):
command = f'::warning title={message}'
command = f'::warning title={q(message)}'
message = message[len('Warning: '):]
elif self.baseline.get('failed', False):
command = f'::notice title={message}'
command = f'::notice title={q(message)}'
message += ' [failed in baseline]'
else:
command = f'::error title={message}'
command = f'::error title={q(message)}'
if extra := getattr(example, 'extra', None):
message += f': {extra}'
message += f': {q(extra)}'
if test.filename:
command += f',file={test.filename}'
if test.lineno is not None and example.lineno is not None:
Expand All @@ -1266,7 +1271,7 @@ def _failure_header(self, test, example, message='Failed example:'):
lineno = None
else:
command += f',line={example.lineno + 1}'
command += f'::{message}'
command += f'::{q(message)}'
out.append(command)
else:
raise ValueError(f'unknown format option: {self.options.format}')
Expand Down Expand Up @@ -1442,7 +1447,7 @@ def report_failure(self, out, test, example, got, globs):
"""
if not self.options.initial or self.no_failure_yet:
self.no_failure_yet = False
example.extra = f'Got: {got!r}'
example.extra = f'Got: {got}'
returnval = doctest.DocTestRunner.report_failure(self, out, test, example, got)
if self.options.debug:
self._fakeout.stop_spoofing()
Expand Down Expand Up @@ -1594,7 +1599,7 @@ def report_unexpected_exception(self, out, test, example, exc_info):
if not self.options.initial or self.no_failure_yet:
self.no_failure_yet = False

example.extra = "Exception raised: " + repr("".join(traceback.format_exception(*exc_info)))
example.extra = "Exception raised:\n" + "".join(traceback.format_exception(*exc_info))
returnval = doctest.DocTestRunner.report_unexpected_exception(self, out, test, example, exc_info)
if self.options.debug:
self._fakeout.stop_spoofing()
Expand Down