Skip to content

Tests: linkcheck: ensure Python clock timezone is reset during test teardown #13537

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

Merged
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
6 changes: 6 additions & 0 deletions tests/test_builders/test_build_linkcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,12 @@ def test_too_many_requests_retry_after_HTTP_date(tz, app, monkeypatch, capsys):
) as address:
app.build()

# Undo side-effects: the monkeypatch context manager clears the TZ environment
# variable, but we also need to reset Python's internal notion of the current
# timezone.
if sys.platform != 'win32':
time.tzset()

content = (app.outdir / 'output.json').read_text(encoding='utf8')
assert json.loads(content) == {
'filename': 'index.rst',
Expand Down
Loading