Skip to content

gh-62917: Add tests for urllib.request.urlcleanup() - #155446

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-62917-urlcleanup-tests
Aug 10, 2026
Merged

gh-62917: Add tests for urllib.request.urlcleanup()#155446
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-62917-urlcleanup-tests

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 9, 2026

Copy link
Copy Markdown
Member

Both side effects of urlcleanup() are covered: the temporary files created by urlretrieve() are removed (and a file recreated under the same name survives a repeated call), and the cached opener is reset, so an explicitly installed opener no longer applies afterwards.

No network is used -- FakeHTTPMixin serves the http responses, and the restricted opener is tested with a data: URL.

Test that it removes temporary files created by urlretrieve() and resets
the cached opener.
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Aug 9, 2026
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 9, 2026
@serhiy-storchaka
serhiy-storchaka merged commit c44dca0 into python:main Aug 10, 2026
59 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Aug 10, 2026

Copy link
Copy Markdown

GH-155465 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 10, 2026
@bedevere-app

bedevere-app Bot commented Aug 10, 2026

Copy link
Copy Markdown

GH-155466 is a backport of this pull request to the 3.14 branch.

@serhiy-storchaka
serhiy-storchaka deleted the gh-62917-urlcleanup-tests branch August 10, 2026 06:52
@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 10, 2026
@bedevere-app

bedevere-app Bot commented Aug 10, 2026

Copy link
Copy Markdown

GH-155467 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Aug 10, 2026
serhiy-storchaka added a commit that referenced this pull request Aug 10, 2026
GH-155467)

Test that it removes temporary files created by urlretrieve() and resets
the cached opener.
(cherry picked from commit c44dca0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Aug 10, 2026
GH-155466)

Test that it removes temporary files created by urlretrieve() and resets
the cached opener.
(cherry picked from commit c44dca0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant