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

test_copyreg: importing numpy changes warnings filters #85175

Closed
vstinner opened this issue Jun 17, 2020 · 5 comments
Closed

test_copyreg: importing numpy changes warnings filters #85175

vstinner opened this issue Jun 17, 2020 · 5 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

BPO 41003
Nosy @vstinner
PRs
  • bpo-41003: Fix test_copyreg when numpy is installed #20935
  • [3.9] bpo-41003: Fix test_copyreg when numpy is installed (GH-20935) #20945
  • [3.8] bpo-41003: Fix test_copyreg when numpy is installed (GH-20935) (GH-20945) #20946
  • 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-06-17.17:10:24.066>
    created_at = <Date 2020-06-17.12:45:57.267>
    labels = ['3.8', 'tests', '3.9', '3.10']
    title = 'test_copyreg: importing numpy changes warnings filters'
    updated_at = <Date 2020-06-17.17:10:24.065>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-06-17.17:10:24.065>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-06-17.17:10:24.066>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2020-06-17.12:45:57.267>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41003
    keywords = ['patch']
    message_count = 5.0
    messages = ['371736', '371737', '371756', '371760', '371764']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['20935', '20945', '20946']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue41003'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @vstinner
    Copy link
    Member Author

    This issue is similar to bpo-40055: running test_copyreg fails with ENV_CHANGED if numpy is available. Example:

    $ ./python -m venv env
    $ env/bin/python -m pip install numpy
    $ env/bin/python -m test --fail-env-changed -v test_copyreg -m xxxx
    == CPython 3.9.0b3+ (heads/getpath_platlibdir39:11462e9847, Jun 11 2020, 17:49:13) [GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]
    (...)
    Warning -- warnings.filters was modified by test_copyreg
      Before: (140498488250848, [], [])
      After:  (140498488250848, [], [('ignore', re.compile('numpy.ndarray size changed', re.IGNORECASE), <class 'Warning'>, None, 0), ('ignore', re.compile('numpy.ufunc size changed', re.IGNORECASE), <class 'Warning'>, None, 0), ('ignore', re.compile('numpy.dtype size changed', re.IGNORECASE), <class 'Warning'>, None, 0), ('always', None, <class 'numpy.RankWarning'>, None, 0)]) 
    (...)

    @vstinner vstinner added 3.10 only security fixes tests Tests in the Lib/test dir labels Jun 17, 2020
    @vstinner
    Copy link
    Member Author

    The issue can be replaced by a fake numpy module:

    $ cat Lib/numpy.py 
    import warnings
    warnings.simplefilter('ignore', UserWarning)

    @vstinner
    Copy link
    Member Author

    New changeset 8362893 by Victor Stinner in branch 'master':
    bpo-41003: Fix test_copyreg when numpy is installed (GH-20935)
    8362893

    @vstinner
    Copy link
    Member Author

    New changeset b39d41b by Victor Stinner in branch '3.9':
    bpo-41003: Fix test_copyreg when numpy is installed (GH-20935) (GH-20945)
    b39d41b

    @vstinner
    Copy link
    Member Author

    New changeset 3d974b2 by Victor Stinner in branch '3.8':
    bpo-41003: Fix test_copyreg when numpy is installed (GH-20935) (GH-20945) (GH-20946)
    3d974b2

    @vstinner vstinner added 3.8 only security fixes 3.9 only security fixes labels Jun 17, 2020
    @vstinner vstinner added 3.8 only security fixes 3.9 only security fixes labels Jun 17, 2020
    @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 tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant