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

Add test coverage for 'today_fmt' reference substitution #10980


Copy link

Type of change

  • Additional test coverage


  • During some self-review of Disable localisation when SOURCE_DATE_EPOCH is set #10949 using pytest, coverage and diff-cover, I noticed that one of the lines affected by the changeset that didn't have any test coverage is this code to substitute named references to 'today' in source documentation with a today_fmt-formatted date. This pull request offers basic test coverage for that part of the code.


  • The DefaultSubstitution class is added as part of a chain of default transformers during app setup. It can substitute named references in a source document with configured text replacements, and has a special case to handle |today| when it appears as a reference with no direct text substitute (but instead a date format substitute) is configured.
  • Indirectly this also adds test coverage for the handling of SOURCE_DATE_EPOCH within util.i18n.format_date, although that wasn't the initial intent of this changeset


@jayaddison jayaddison force-pushed the coverage/today-fmt-reference-substitution branch from f6f52eb to b25b767 Compare December 16, 2022 21:32
@AA-Turner AA-Turner merged commit 041e5f8 into sphinx-doc:master Dec 29, 2022
@jayaddison jayaddison deleted the coverage/today-fmt-reference-substitution branch December 29, 2022 14:30
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants