diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:31:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:31:33 +0000 |
commit | e863fd965dd6253243c3342bd6f0adc4fc8aec4d (patch) | |
tree | a4c1b6491a82593950043c3f8b2530e80664d768 /tests/test_correct_year.py | |
parent | Initial commit. (diff) | |
download | sphinx-e863fd965dd6253243c3342bd6f0adc4fc8aec4d.tar.xz sphinx-e863fd965dd6253243c3342bd6f0adc4fc8aec4d.zip |
Adding upstream version 5.3.0.upstream/5.3.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_correct_year.py')
-rw-r--r-- | tests/test_correct_year.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_correct_year.py b/tests/test_correct_year.py new file mode 100644 index 0000000..4e9de6c --- /dev/null +++ b/tests/test_correct_year.py @@ -0,0 +1,28 @@ +"""Test copyright year adjustment""" +import pytest + + +@pytest.fixture( + params=[ + # test with SOURCE_DATE_EPOCH unset: no modification + (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 + if sde: + monkeypatch.setenv('SOURCE_DATE_EPOCH', sde) + else: + monkeypatch.delenv('SOURCE_DATE_EPOCH', raising=False) + yield expect + + +@pytest.mark.sphinx('html', testroot='correct-year') +def test_correct_year(expect_date, app): + app.build() + content = (app.outdir / 'index.html').read_text(encoding='utf8') + assert expect_date in content |