diff --git a/CHANGES.rst b/CHANGES.rst index f9a587f3181..23ace2d3bc1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -58,3 +58,6 @@ Bugs fixed Testing ------- + +* #13224: Correctness fixup for ``test_html_multi_line_copyright``. + Patch by Colin Watson, applied by James Addison. diff --git a/tests/test_builders/test_build_html_copyright.py b/tests/test_builders/test_build_html_copyright.py index 7a18bceb603..69ddd2d1f8a 100644 --- a/tests/test_builders/test_build_html_copyright.py +++ b/tests/test_builders/test_build_html_copyright.py @@ -9,6 +9,18 @@ LOCALTIME_2009 = type(LT)(LT_NEW) +@pytest.fixture +def no_source_date_year(monkeypatch): + """ + Explicitly clear SOURCE_DATE_EPOCH from the environment; this + fixture can be used to ensure that copyright substitution logic + does not occur during selected test cases. + """ + with monkeypatch.context() as m: + m.delenv('SOURCE_DATE_EPOCH', raising=False) + yield + + @pytest.fixture( params=[ 1199145600, # 2008-01-01 00:00:00 @@ -24,7 +36,7 @@ def source_date_year(request, monkeypatch): @pytest.mark.sphinx('html', testroot='copyright-multiline') -def test_html_multi_line_copyright(app): +def test_html_multi_line_copyright(no_source_date_year, app): app.build(force_all=True) content = (app.outdir / 'index.html').read_text(encoding='utf-8')