Skip to content
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

3.9.0 test_site warning: "urllib.requests._opener was modified by test_site" #86105

Closed
ned-deily opened this issue Oct 5, 2020 · 11 comments
Closed
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes deferred-blocker tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@ned-deily
Copy link
Member

BPO 41939
Nosy @vstinner, @ned-deily, @ambv, @miss-islington
PRs
  • bpo-41939: Fix test_site.test_license_exists_at_url() #22559
  • [3.9] bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) #22567
  • [3.8] bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) #22574
  • bpo-41939: do not skip test_site.test_license_exists_at_url for pre-releases #22688
  • [3.9] bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688) #22689
  • [3.8] bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688) #22690
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-10-06.07:11:48.046>
    created_at = <Date 2020-10-05.07:01:03.150>
    labels = ['deferred-blocker', 'type-bug', '3.8', '3.9', '3.10', 'tests']
    title = '3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"'
    updated_at = <Date 2020-10-14.15:46:22.048>
    user = 'https://github.com/ned-deily'

    bugs.python.org fields:

    activity = <Date 2020-10-14.15:46:22.048>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-10-06.07:11:48.046>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2020-10-05.07:01:03.150>
    creator = 'ned.deily'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41939
    keywords = ['patch']
    message_count = 11.0
    messages = ['377995', '377997', '377998', '378059', '378064', '378093', '378592', '378595', '378596', '378597', '378627']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'ned.deily', 'lukasz.langa', 'miss-islington']
    pr_nums = ['22559', '22567', '22574', '22688', '22689', '22690']
    priority = 'deferred blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue41939'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @ned-deily
    Copy link
    Member Author

    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 bpo-37421: "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.

    @ned-deily ned-deily added 3.10 only security fixes 3.9 only security fixes deferred-blocker tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Oct 5, 2020
    @vstinner
    Copy link
    Member

    vstinner commented Oct 5, 2020

    It's a minor issue in the test itself, not in urllib. Such bug should not block a release.

    @vstinner
    Copy link
    Member

    vstinner commented Oct 5, 2020

    I proposed PR 22559 to fix the issue.

    See also bpo-37475: "What is urllib.request.urlcleanup() function?".

    @ambv
    Copy link
    Contributor

    ambv commented Oct 5, 2020

    New changeset 1fce240 by Victor Stinner in branch 'master':
    bpo-41939: Fix test_site.test_license_exists_at_url() (bpo-22559)
    1fce240

    @ambv
    Copy link
    Contributor

    ambv commented Oct 5, 2020

    New changeset 10b4136 by Miss Skeleton (bot) in branch '3.9':
    bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) (bpo-22567)
    10b4136

    @miss-islington
    Copy link
    Contributor

    New changeset 78bddc7 by Miss Skeleton (bot) in branch '3.8':
    bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559)
    78bddc7

    @vstinner vstinner added the 3.8 only security fixes label Oct 6, 2020
    @vstinner vstinner closed this as completed Oct 6, 2020
    @vstinner vstinner added the 3.8 only security fixes label Oct 6, 2020
    @vstinner vstinner closed this as completed Oct 6, 2020
    @ned-deily
    Copy link
    Member Author

    New changeset 6a48518 by Ned Deily in branch 'master':
    bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
    6a48518

    @miss-islington
    Copy link
    Contributor

    New changeset 8b4642d by Miss Skeleton (bot) in branch '3.8':
    bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
    8b4642d

    @miss-islington
    Copy link
    Contributor

    New changeset 881a13c by Miss Skeleton (bot) in branch '3.9':
    bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
    881a13c

    @ned-deily
    Copy link
    Member Author

    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.

    @vstinner
    Copy link
    Member

    You're welcome ;-)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes deferred-blocker tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants