8000 [3.8] bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) by miss-islington · Pull Request #22574 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.8] bpo-41939 8000 : Fix test_site.test_license_exists_at_url() (GH-22559) #22574

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
merged 1 commit into from
Oct 6, 2020
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
bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559)
Call urllib.request.urlcleanup() to reset the global
urllib.request._opener.
(cherry picked from commit 1fce240)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
vstinner authored and miss-islington committed Oct 6, 2020
commit 4ab7ccdf2c8adc8e91444d4ca96f3f0127ed5ad7
2 changes: 2 additions & 0 deletions Lib/test/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ def test_license_exists_at_url(self):
# string displayed by license in the absence of a LICENSE file.
url = license._Printer__data.split()[1]
req = urllib.request.Request(url, method='HEAD')
# Reset global urllib.request._opener
self.addCleanup(urllib.request.urlcleanup)
try:
with test.support.transient_internet(url):
with urllib.request.urlopen(req) as data:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix test_site.test_license_exists_at_url(): call
``urllib.request.urlcleanup()`` to reset the global
``urllib.request._opener``. Patch by Victor Stinner.
0