mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Remove mypy override for `tests.test_builders.test_build_html_copyright
` (#13317)
This commit is contained in:
parent
46b6d55467
commit
03df8119b3
@ -208,7 +208,6 @@ module = [
|
||||
"tests.test_builders.test_build_html_5_output",
|
||||
"tests.test_builders.test_build_html_assets",
|
||||
"tests.test_builders.test_build_html_code",
|
||||
"tests.test_builders.test_build_html_copyright",
|
||||
"tests.test_builders.test_build_html_download",
|
||||
"tests.test_builders.test_build_html_highlight",
|
||||
"tests.test_builders.test_build_html_image",
|
||||
|
@ -1,16 +1,22 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterator
|
||||
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
|
||||
LT = time.localtime()
|
||||
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):
|
||||
def no_source_date_year(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
|
||||
"""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.
|
||||
@ -26,7 +32,10 @@ def no_source_date_year(monkeypatch):
|
||||
1199145599, # 2007-12-31 23:59:59
|
||||
]
|
||||
)
|
||||
def source_date_year(request, monkeypatch):
|
||||
def source_date_year(
|
||||
request: pytest.FixtureRequest,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> Iterator[int]:
|
||||
source_date_epoch = request.param
|
||||
with monkeypatch.context() as m:
|
||||
m.setattr(time, 'localtime', lambda *a: LOCALTIME_2009)
|
||||
@ -35,7 +44,9 @@ def source_date_year(request, monkeypatch):
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='copyright-multiline')
|
||||
def test_html_multi_line_copyright(no_source_date_year, app):
|
||||
def test_html_multi_line_copyright(
|
||||
no_source_date_year: None, app: SphinxTestApp
|
||||
) -> None:
|
||||
app.build(force_all=True)
|
||||
|
||||
content = (app.outdir / 'index.html').read_text(encoding='utf-8')
|
||||
@ -65,7 +76,9 @@ def test_html_multi_line_copyright(no_source_date_year, app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='copyright-multiline')
|
||||
def test_html_multi_line_copyright_sde(source_date_year, app):
|
||||
def test_html_multi_line_copyright_sde(
|
||||
source_date_year: None, app: SphinxTestApp
|
||||
) -> None:
|
||||
app.build(force_all=True)
|
||||
|
||||
content = (app.outdir / 'index.html').read_text(encoding='utf-8')
|
||||
|
Loading…
Reference in New Issue
Block a user