Commit Graph

5 Commits

Author SHA1 Message Date
Adam Turner
c4daa95c09 Enable the entire D category in Ruff 2025-01-14 15:55:02 +00:00
James Addison
267fe9afa8
Tests: explicitly unset SOURCE_DATE_EPOCH during 'test_html_multi_line_copyright' (#13224)
Sphinx's copyright substitution currently allows years identified as
the current year to be downgraded to previous years when
``SOURCE_DATE_EPOCH`` is configured, to assist reproducibility [1] of
documentation builds.

However, we have a test case ``test_html_multi_line_copyright``,
written in 2024, that mentioned a future year (2025).

Now that we have reached 2025, it is eligible for substitution when
``SOURCE_DATE_EPOCH`` is configured.  Many buildsystems, such as those
used by Debian and Fedora, choose the most-recent packaging/commit
timestamp to use as `SOURCE_DATE_EPOCH`'s timestamp, since those
correspond sensibly to a time-of-build.

However, for the Sphinx 8.1.3 release including the updated
substitution logic, the year-of-release/commit was 2024. Thus, if a
commit/packaging date from that year is chosen, and
``SOURCE_DATE_EPOCH`` is configured when the unit tests run, the
``test_html_multi_line_copyright`` test will fail.

The fix suggested here is to explicitly unset ``SOURCE_DATE_EPOCH``
within ``test_html_multi_line_copyright``.

[1]: https://www.reproducible-builds.org/

Authored-by: Colin Watson <cjwatson@debian.org>
Co-authored-by: Colin Watson <cjwatson@debian.org>
Authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>
Co-authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>
2025-01-10 11:21:11 +00:00
Adam Turner
3af48520d2 Require the PEP 563 'annotations' future import 2024-11-22 21:54:26 +00:00
James Addison
a84f7009ac
Restrict substitution of `copyright` years (#12516)
Only substitute copyright notice years with values from
``SOURCE_DATE_EPOCH`` for entries that match the current
system clock year, and disallow substitution of future years.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-10-04 10:48:47 +01:00
Adam Turner
5f3846f8c6
Improve testing for copyright year substitution (#12950) 2024-10-03 21:56:50 +01:00