On Thu, Jan 02, 2025 at 06:09:35PM +0000, Santiago Vila wrote:
> =================================== FAILURES 
> ===================================
> ________________________ test_html_multi_line_copyright 
> ________________________
> 
> app = <SphinxTestApp buildername='html'>
> 
>     @pytest.mark.sphinx('html', testroot='copyright-multiline')
>     def test_html_multi_line_copyright(app):
>         app.build(force_all=True)
>     
>         content = (app.outdir / 'index.html').read_text(encoding='utf-8')
>     
>         # check the copyright footer line by line (empty lines ignored)
>         assert '  &#169; Copyright 2006.<br/>\n' in content
>         assert '  &#169; Copyright 2006-2009, Alice.<br/>\n' in content
>         assert '  &#169; Copyright 2010-2013, Bob.<br/>\n' in content
>         assert '  &#169; Copyright 2014-2017, Charlie.<br/>\n' in content
>         assert '  &#169; Copyright 2018-2021, David.<br/>\n' in content
> >       assert '  &#169; Copyright 2022-2025, Eve.' in content
> E       assert '  &#169; Copyright 2022-2025, Eve.' in '<!DOCTYPE 
> html>\n\n<html lang="en" data-content_root="./">\n  <head>\n    <meta 
> charset="utf-8" />\n    <meta name="viewport" content="width=device-width, 
> initial-scale=1.0" /><meta name="viewport" content="width=device-width, 
> initial-scale=1" />\n\n    <title>&lt;no title&gt; &#8212; Project name not 
> set  documentation</title>\n    <link rel="stylesheet" type="text/css" 
> href="_static/pygments.css?v=8e8a900e" />\n    <link rel="stylesheet" 
> type="text/css" href="_static/basic.css?v=5c69cfe2" />\n    <script 
> src="_static/documentation_options.js?v=5929fcd5"></script>\n    <script 
> src="_static/doctools.js?v=9bcbadda"></script>\n    <script 
> src="_static/sphinx_highlight.js?v=dc90522c"></script>\n    <link rel="index" 
> title="Index" href="genindex.html" />\n    <link rel="search" title="Search" 
> href="search.html" /> \n  </head><body>\n    <div class="related" 
> role="navigation" aria-label="Related">\n      <h3>Navigation</h3>\n      
> <ul>\n        <li class="right" style="margin-right: 10px">\n          <a 
> href="genindex.html" title="General Index"\n             
> accesskey="I">index</a></li>\n        <li class="nav-item nav-item-0"><a 
> href="#">Project name not set  documentation</a> &#18...f" 
> autocapitalize="off" spellcheck="false"/>\n      <input type="submit" 
> value="Go" />\n    </form>\n    
> </div>\n</search>\n<script>document.getElementById(\'searchbox\').style.display
>  = "block"</script>\n        </div>\n      </div>\n      <div 
> class="clearer"></div>\n    </div>\n    <div class="related" 
> role="navigation" aria-label="Related">\n      <h3>Navigation</h3>\n      
> <ul>\n        <li class="right" style="margin-right: 10px">\n          <a 
> href="genindex.html" title="General Index"\n             >index</a></li>\n    
>     <li class="nav-item nav-item-0"><a href="#">Project name not set  
> documentation</a> &#187;</li>\n        <li class="nav-item nav-item-this"><a 
> href="">&lt;no title&gt;</a></li> \n      </ul>\n    </div>\n    <div 
> class="footer" role="contentinfo">\n    \n      &#169; Copyright 2006.<br/>\n 
>    \n      &#169; Copyright 2006-2009, Alice.<br/>\n    \n      &#169; 
> Copyright 2010-2013, Bob.<br/>\n    \n      &#169; Copyright 2014-2017, 
> Charlie.<br/>\n    \n      &#169; Copyright 2018-2021, David.<br/>\n    \n    
>   &#169; Copyright 2022-2024, Eve.\n    \n      Created using <a 
> href="https://www.sphinx-doc.org/";>Sphinx</a> 8.1.3.\n    </div>\n  
> </body>\n</html>'
> 
> tests/test_builders/test_build_html_copyright.py:36: AssertionError

I came up with the following patch for this, but then I noticed
https://github.com/sphinx-doc/sphinx/pull/13203 from Dmitry which seems
at least sort of overlapping even though it doesn't really seem to be
the same thing.  Dmitry, what do you think?  If it seems reasonable then
I'll send an upstream PR.

diff --git a/tests/test_builders/test_build_html_copyright.py 
b/tests/test_builders/test_build_html_copyright.py
index 7a18bceb6..db6dbbc5f 100644
--- a/tests/test_builders/test_build_html_copyright.py
+++ b/tests/test_builders/test_build_html_copyright.py
@@ -9,6 +9,13 @@ LT_NEW = (2009, *LT[1:], LT.tm_zone, LT.tm_gmtoff)
 LOCALTIME_2009 = type(LT)(LT_NEW)
 
 
+@pytest.fixture
+def no_source_date_year(monkeypatch):
+    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 +31,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')

Thanks,

-- 
Colin Watson (he/him)                              [cjwat...@debian.org]

Reply via email to