Skip to content

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

Closed

Description

@ned-deily
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']

    Activity

    1. ned-deily commented on Oct 5, 2020

      @ned-deily
      MemberAuthor

      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.

    2. vstinner commented on Oct 5, 2020

      @vstinner
      Member

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

    3. vstinner commented on Oct 5, 2020

      @vstinner
      Member

      I proposed PR 22559 to fix the issue.

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

    4. ambv commented on Oct 5, 2020

      @ambv
      Contributor

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

    5. ambv commented on Oct 5, 2020

      @ambv
      Contributor

      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

    6. miss-islington commented on Oct 6, 2020

      @miss-islington
      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

    7. ned-deily commented on Oct 14, 2020

      @ned-deily
      MemberAuthor

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

    8. miss-islington commented on Oct 14, 2020

      @miss-islington
      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

    9. miss-islington commented on Oct 14, 2020

      @miss-islington
      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

    10. ned-deily commented on Oct 14, 2020

      @ned-deily
      MemberAuthor

      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.

    11. vstinner commented on Oct 14, 2020

      @vstinner
      Member

      You're welcome ;-)

    12. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions