Files
sphinx/tests/test_correct_year.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
811 B
Python
Raw Normal View History

"""Test copyright year adjustment"""
2017-01-07 00:46:26 +09:00
import pytest
2017-01-07 00:46:26 +09:00
@pytest.fixture(
params=[
# test with SOURCE_DATE_EPOCH unset: no modification
2017-01-07 00:46:26 +09:00
(None, '2006-2009'),
# test with SOURCE_DATE_EPOCH set: copyright year should be updated
('1293840000', '2006-2011'),
('1293839999', '2006-2010'),
],
)
def expect_date(request, monkeypatch):
sde, expect = request.param
2023-02-17 23:46:31 +00:00
with monkeypatch.context() as m:
if sde:
m.setenv('SOURCE_DATE_EPOCH', sde)
else:
m.delenv('SOURCE_DATE_EPOCH', raising=False)
yield expect
2017-01-07 00:46:26 +09:00
@pytest.mark.sphinx('html', testroot='correct-year')
def test_correct_year(expect_date, app):
app.build()
2022-04-27 03:04:19 +01:00
content = (app.outdir / 'index.html').read_text(encoding='utf8')
2017-01-07 00:46:26 +09:00
assert expect_date in content