Mailing List Archive

[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34
New submission from Miro Hron?ok <miro@hroncok.cz>:

Hello.

When we attempted to upgrade to Python 3.10.0b3 on Fedora 33 and 34, we see the following test failure:



======================================================================
ERROR: test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests)
Prior versions of Distribution.entry_points would return a
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/Python-3.10.0b3/Lib/test/test_importlib/test_metadata_api.py", line 145, in test_entry_points_by_index
expected = next(iter(caught))
StopIteration
----------------------------------------------------------------------
Ran 1402 tests in 2.125s
FAILED (errors=1, skipped=18, expected failures=1)


I've reproduced it without any Fedora's patches:

$ cd cpython
$ git switch -d v3.10.0b3 # or the tip of 3.10 today, 77eaf14d27

$ ./configure --enable-shared && make

$ LD_LIBRARY_PATH=. ./python -m test test_importlib
0:00:00 load avg: 13.59 Run tests sequentially
0:00:00 load avg: 13.59 [1/1] test_importlib
test test_importlib failed -- Traceback (most recent call last):
File "/home/churchyard/Dokumenty/RedHat/cpython/Lib/test/test_importlib/test_metadata_api.py", line 145, in test_entry_points_by_index
expected = next(iter(caught))
StopIteration

test_importlib failed

== Tests result: FAILURE ==

1 test failed:
test_importlib

Total duration: 11.0 sec
Tests result: FAILURE

----------
components: Library (Lib)
messages: 396051
nosy: hroncok, jaraco
priority: normal
severity: normal
status: open
title: test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Miro Hron?ok <miro@hroncok.cz> added the comment:

Also reproduced on the main branch.

----------
versions: +Python 3.11

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment:

This seems to have been reported also at https://bugs.python.org/issue44246#msg395202

----------
nosy: +xtreak

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Miro Hron?ok <miro@hroncok.cz> added the comment:

Also reproducible without --enable-shared.

[cpython (main)]$ ./configure && make
[cpython (main)]$ ./python --version
Python 3.11.0a0

[cpython (main)]$ ./python -m test test_importlib
0:00:00 load avg: 5.40 Run tests sequentially
0:00:00 load avg: 5.40 [1/1] test_importlib
test test_importlib failed -- Traceback (most recent call last):
File "/home/churchyard/Dokumenty/RedHat/cpython/Lib/test/test_importlib/test_metadata_api.py", line 145, in test_entry_points_by_index
expected = next(iter(caught))
StopIteration

test_importlib failed

== Tests result: FAILURE ==

1 test failed:
test_importlib

Total duration: 3.5 sec
Tests result: FAILURE

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Miro Hron?ok <miro@hroncok.cz> added the comment:

I get the DeprecationWarning the tests assumes when not running via the test:

$ cat distinfo_pkg-1.0.0.dist-info/entry_points.txt
[entries]
main = mod:main
ns:sub = mod:main

$ ./python
Python 3.11.0a0 (heads/main:0982ded179, Jun 18 2021, 14:14:16) [GCC 10.3.1 20210422 (Red Hat 10.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, sys
>>> sys.path.insert(0, os.path.abspath('.'))
>>> from importlib.metadata import distribution
>>> distribution('distinfo-pkg')
<importlib.metadata.PathDistribution object at 0x7f1796d8bcd0>
>>> eps = distribution('distinfo-pkg').entry_points
>>> eps[0]
<stdin>:1: DeprecationWarning: Accessing entry points by index is deprecated. Cast to tuple if needed.
EntryPoint(name='main', value='mod:main', group='entries')


Not sure why I don't get it in the test yet.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Miro Hron?ok <miro@hroncok.cz> added the comment:

I've added warnings.resetwarnings() to the test. it makes it pass.

It says:


Warning -- warnings.filters was modified by test_importlib
Before: (140568295281984, [.('default', None, <class 'DeprecationWarning'>, '__main__', 0), ('ignore', None, <class 'DeprecationWarning'>, None, 0), ('ignore', None, <class 'PendingDeprecationWarning'>, None, 0), ('ignore', None, <class 'ImportWarning'>, None, 0), ('ignore', None, <class 'ResourceWarning'>, None, 0)], [.('default', None, <class 'DeprecationWarning'>, '__main__', 0), ('ignore', None, <class 'DeprecationWarning'>, None, 0), ('ignore', None, <class 'PendingDeprecationWarning'>, None, 0), ('ignore', None, <class 'ImportWarning'>, None, 0), ('ignore', None, <class 'ResourceWarning'>, None, 0)])
After: (140568295281984, [.('default', None, <class 'DeprecationWarning'>, '__main__', 0), ('ignore', None, <class 'DeprecationWarning'>, None, 0), ('ignore', None, <class 'PendingDeprecationWarning'>, None, 0), ('ignore', None, <class 'ImportWarning'>, None, 0), ('ignore', None, <class 'ResourceWarning'>, None, 0)], [])
test_importlib failed (env changed)

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Miro Hron?ok <miro@hroncok.cz> added the comment:

Adding the reset to the context manager:

with warnings.catch_warnings(record=True) as caught:
warnings.resetwarnings()
eps[0]

Or even better explicitly:

with warnings.catch_warnings(record=True) as caught:
warnings.filterwarnings("default", category=DeprecationWarning)
eps[0]

Makes it pass and makes the tests framework happy. I still don't understand why it is filtered, but other tests in the file (e.g. test_entry_points_dict_construction) already o this, so I will submit a pull request.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Change by Miro Hron?ok <miro@hroncok.cz>:


----------
components: +Tests -Library (Lib)

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Change by Miro Hron?ok <miro@hroncok.cz>:


----------
keywords: +patch
pull_requests: +25369
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26784

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Jason R. Coombs <jaraco@jaraco.com> added the comment:

Other tests reset the filters? Good observation. I’d missed that detail. If it’s easier to submit a PR to importlib_metadata, feel free to do that as I’ll want the change in both places.

----------
components: +Library (Lib) -Tests
stage: patch review ->

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Miro Hron?ok <miro@hroncok.cz> added the comment:

Submitted to both.

https://github.com/python/cpython/pull/26784
https://github.com/python/importlib_metadata/pull/325

----------
components: +Tests -Library (Lib)

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Jason R. Coombs <jaraco@jaraco.com> added the comment:


New changeset df1502e47fc1e0cf1e7d460ae04530c3e2e4a7c6 by Miro Hron?ok in branch 'main':
bpo-44451: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_index (GH-26784)
https://github.com/python/cpython/commit/df1502e47fc1e0cf1e7d460ae04530c3e2e4a7c6


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>:


----------
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +25374
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26790

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
Jason R. Coombs <jaraco@jaraco.com> added the comment:

Big thanks Miro for the detailed work on this matter.

----------
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44451] test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) fails on Fedora 33 and 34 [ In reply to ]
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment:


New changeset bf55a799e0c19285b094d71f794c301c1afaa28d by Miss Islington (bot) in branch '3.10':
bpo-44451: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_index (GH-26784)
https://github.com/python/cpython/commit/bf55a799e0c19285b094d71f794c301c1afaa28d


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com