classification
Title: 3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lukasz.langa, miss-islington, ned.deily, vstinner
Priority: deferred blocker Keywords: patch

Created on 2020-10-05 07:01 by ned.deily, last changed 2020-10-14 15:46 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22559 merged vstinner, 2020-10-05 07:38
PR 22567 merged miss-islington, 2020-10-05 16:24
PR 22574 merged miss-islington, 2020-10-06 06:44
PR 22688 merged ned.deily, 2020-10-14 00:53
PR 22689 merged miss-islington, 2020-10-14 01:39
PR 22690 merged miss-islington, 2020-10-14 01:39
Messages (11)
msg377995 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-10-05 07:01
For 3.9.0, test_site fails with an env changed warning:

Warning -- urllib.requests._opener was modified by test_site
  Before: None
  After:  <urllib.request.OpenerDirector object at 0xb76f4f88>
test_site failed (env changed)

== Tests result: SUCCESS ==

1 test altered the execution environment:
    test_site

The problem occurs in test_site's test_license_exists_at_url test and was introduced by the changes in Issue37421: "Some tests leak temporary files".

This failure has not been noticed up to now because test_license_exists_at_url is skipped unless the build being tested is for a released branch, which is about to happen for 3.9 with the 3.9.0 release.  The test failure can be reproduced on any build by commenting out Lib/test_site.py lines 503-504:

    @unittest.skipUnless(sys.version_info[3] == 'final',
                         'only for released versions')

Setting to "deferred blocker" status for release manager evaluation.
msg377997 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-05 07:29
It's a minor issue in the test itself, not in urllib. Such bug should not block a release.
msg377998 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-05 07:39
I proposed PR 22559 to fix the issue.

See also bpo-37475: "What is urllib.request.urlcleanup() function?".
msg378059 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2020-10-05 16:24
New changeset 1fce240d6c4b2b2cc17a86e88c65169e15b9feeb by Victor Stinner in branch 'master':
bpo-41939: Fix test_site.test_license_exists_at_url() (#22559)
https://github.com/python/cpython/commit/1fce240d6c4b2b2cc17a86e88c65169e15b9feeb
msg378064 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2020-10-05 16:49
New changeset 10b4136bfa5878c058753e1d1bd091e0f7e1ba40 by Miss Skeleton (bot) in branch '3.9':
bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) (#22567)
https://github.com/python/cpython/commit/10b4136bfa5878c058753e1d1bd091e0f7e1ba40
msg378093 - (view) Author: miss-islington (miss-islington) Date: 2020-10-06 07:03
New changeset 78bddc7794a629614dc84e195b9117416ae97ed3 by Miss Skeleton (bot) in branch '3.8':
bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559)
https://github.com/python/cpython/commit/78bddc7794a629614dc84e195b9117416ae97ed3
msg378592 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-10-14 01:39
New changeset 6a48518e8dac3521ff387ee67cdf33783114a257 by Ned Deily in branch 'master':
bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
https://github.com/python/cpython/commit/6a48518e8dac3521ff387ee67cdf33783114a257
msg378595 - (view) Author: miss-islington (miss-islington) Date: 2020-10-14 01:59
New changeset 8b4642d3288e187faad24283c949ecf53fecad5b by Miss Skeleton (bot) in branch '3.8':
bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
https://github.com/python/cpython/commit/8b4642d3288e187faad24283c949ecf53fecad5b
msg378596 - (view) Author: miss-islington (miss-islington) Date: 2020-10-14 01:59
New changeset 881a13cad534cf3fe4474579c22235a15d3ba27b by Miss Skeleton (bot) in branch '3.9':
bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
https://github.com/python/cpython/commit/881a13cad534cf3fe4474579c22235a15d3ba27b
msg378597 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-10-14 02:12
Thanks for the fix, Victor.

Sometime after filing this, I remembered that we had seen a similar problem some years ago and found bpo-21572 in which I had changed Lib/site.py to no longer use a release-dependent URL for the license file - which is why the check to skip if on a pre-release had been added previously to test_license_exists_at_url. So I should have removed the skip in test_site at the same time as it is no longer needed and hides problems like this until the final release.  PR 22688 and its backports remove the skip.
msg378627 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-14 15:46
You're welcome ;-)
History
Date User Action Args
2020-10-14 15:46:22vstinnersetmessages: + msg378627
2020-10-14 02:12:03ned.deilysetmessages: + msg378597
2020-10-14 01:59:50miss-islingtonsetmessages: + msg378596
2020-10-14 01:59:20miss-islingtonsetmessages: + msg378595
2020-10-14 01:39:38miss-islingtonsetpull_requests: + pull_request21661
2020-10-14 01:39:26miss-islingtonsetpull_requests: + pull_request21660
2020-10-14 01:39:03ned.deilysetmessages: + msg378592
2020-10-14 00:53:15ned.deilysetpull_requests: + pull_request21658
2020-10-06 07:11:48vstinnersetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.8
2020-10-06 07:03:34miss-islingtonsetmessages: + msg378093
2020-10-06 06:44:42miss-islingtonsetpull_requests: + pull_request21569
2020-10-05 16:49:49lukasz.langasetmessages: + msg378064
2020-10-05 16:24:17miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request21563
2020-10-05 16:24:15lukasz.langasetmessages: + msg378059
2020-10-05 07:39:00vstinnersetmessages: + msg377998
2020-10-05 07:38:17vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request21554
2020-10-05 07:29:14vstinnersetmessages: + msg377997
2020-10-05 07:01:03ned.deilycreate