summaryrefslogtreecommitdiffstats
path: root/tests/test_correct_year.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:25:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:25:40 +0000
commitcf7da1843c45a4c2df7a749f7886a2d2ba0ee92a (patch)
tree18dcde1a8d1f5570a77cd0c361de3b490d02c789 /tests/test_correct_year.py
parentInitial commit. (diff)
downloadsphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.tar.xz
sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.zip
Adding upstream version 7.2.6.upstream/7.2.6upstream
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.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_correct_year.py b/tests/test_correct_year.py
new file mode 100644
index 0000000..4ef77a6
--- /dev/null
+++ b/tests/test_correct_year.py
@@ -0,0 +1,29 @@
+"""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
+ with monkeypatch.context() as m:
+ if sde:
+ m.setenv('SOURCE_DATE_EPOCH', sde)
+ else:
+ m.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