8000 bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) (#22… · python/cpython@10b4136 · GitHub
[go: up one dir, main page]

Skip to content

Commit 10b4136

Browse filesBrowse files
bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) (#22567)
Call urllib.request.urlcleanup() to reset the global urllib.request._opener. (cherry picked from commit 1fce240) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 1691435 commit 10b4136

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Lib/test/test_site.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,8 @@ def test_license_exists_at_url(self):
509509
# string displayed by license in the absence of a LICENSE file.
510510
url = license._Printer__data.split()[1]
511511
req = urllib.request.Request(url, method='HEAD')
512+
# Reset global urllib.request._opener
513+
self.addCleanup(urllib.request.urlcleanup)
512514
try:
513515
with socket_helper.transient_internet(url):
514516
with urllib.request.urlopen(req) as data:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix test_site.test_license_exists_at_url(): call
2+
``urllib.request.urlcleanup()`` to reset the global
3+
``urllib.request._opener``. Patch by Victor Stinner.

0 commit comments

Comments
 (0)
0