Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: fixup: explicitly unset SOURCE_DATE_EPOCH during 'test_html_multi_line_copyright' #13224

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ Bugs fixed

Testing
-------

* #13224: Correctness fixup for ``test_html_multi_line_copyright``.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I acknowledge that this entry may not be strictly required, but we do have a changelog section for Testing, and I think this fits within that topic.

Patch by Colin Watson, applied by James Addison.
14 changes: 13 additions & 1 deletion tests/test_builders/test_build_html_copyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@
LOCALTIME_2009 = type(LT)(LT_NEW)


@pytest.fixture
def no_source_date_year(monkeypatch):
"""
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.
"""
with monkeypatch.context() as m:
m.delenv('SOURCE_DATE_EPOCH', raising=False)
yield


@pytest.fixture(
params=[
1199145600, # 2008-01-01 00:00:00
Expand All @@ -24,7 +36,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')
Expand Down
Loading