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

bpo-44451: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_index #26784

Merged
merged 1 commit into from
Jun 18, 2021

Conversation

hroncok
Copy link
Contributor

@hroncok hroncok commented Jun 18, 2021

This avoids the following error if DeprecationWarnings are ignored.

======================================================================
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)

https://bugs.python.org/issue44451

…try_points_by_index

This avoids the following error if DeprecationWarnings are ignored.

    ======================================================================
    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)
@hroncok
Copy link
Contributor Author

hroncok commented Jun 18, 2021

Also in python/importlib_metadata#325

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

cc @warsaw @jaraco: I'm not comfortable to merge this change, since there is the importlib_metadata package on PyPI and I don't how it's maintained and by who. Miro already created a backport PR! python/importlib_metadata#325

Without the PR, the test fails with -Wignore:

$ ./python -Wignore -m test test_importlib -m test_entry_points_by_index
...
test test_importlib failed -- Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_importlib/test_metadata_api.py", line 145, in test_entry_points_by_index
    expected = next(iter(caught))
StopIteration
Tests result: FAILURE

With the PR, the test pass as expected:

$ ./python -Wignore -m test test_importlib -m test_entry_points_by_index
...
Tests result: SUCCESS

@vstinner
Copy link
Member

Azure Pipelines PR — #20210618.18 failed

test_httpservers failed on 32-bit and 64-bit Windows jobs, no idea why:

======================================================================
FAIL: test_accept (test.test_httpservers.CGIHTTPServerTestCase) [OrderedDict([('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')])]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\1\s\lib\test\test_httpservers.py", line 854, in test_accept
    self.assertIn(expected.encode('ascii'), res.read())
AssertionError: b"'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'" not found in b''

======================================================================
FAIL: test_accept (test.test_httpservers.CGIHTTPServerTestCase) [OrderedDict()]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\1\s\lib\test\test_httpservers.py", line 854, in test_accept
    self.assertIn(expected.encode('ascii'), res.read())
AssertionError: b"'HTTP_ACCEPT': ''" not found in b''

======================================================================
FAIL: test_accept (test.test_httpservers.CGIHTTPServerTestCase) [OrderedDict([('Accept', 'text/html'), ('ACCEPT', 'text/plain')])]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\1\s\lib\test\test_httpservers.py", line 854, in test_accept
    self.assertIn(expected.encode('ascii'), res.read())
AssertionError: b"'HTTP_ACCEPT': 'text/html,text/plain'" not found in b''

@jaraco jaraco added the needs backport to 3.10 only security fixes label Jun 18, 2021
@jaraco
Copy link
Member

jaraco commented Jun 18, 2021

test_httpservers failed on 32-bit and 64-bit Windows jobs, no idea why:

I'm all but certain this failure is spurious, unrelated, and thus ignorable.

Also in python/importlib_metadata#325

Thanks for that... although now I notice that the third-party module neither needs the behavior nor implements it for test_entry_points_dict_construction. Since it's seemingly only needed for CPython, I'm tempted to just merge the changes here (and the cpython branch of importlib_metadata).

Regardless, I'd like to make the approach consistent. I'll work on that in importlib_metadata. This change is good for CPython here and best to get it in asap.

@jaraco
Copy link
Member

jaraco commented Jun 18, 2021

I don't see any way to re-run the failed tests, so I'm going to assume they're spurious and proceed.

@jaraco jaraco merged commit df1502e into python:main Jun 18, 2021
@miss-islington
Copy link
Contributor

Thanks @hroncok for the PR, and @jaraco for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 18, 2021
…try_points_by_index (pythonGH-26784)

This avoids the following error if DeprecationWarnings are ignored.

    ======================================================================
    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)
(cherry picked from commit df1502e)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
@bedevere-bot
Copy link

GH-26790 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jun 18, 2021
miss-islington added a commit that referenced this pull request Jun 18, 2021
…try_points_by_index (GH-26784)

This avoids the following error if DeprecationWarnings are ignored.

    ======================================================================
    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)
(cherry picked from commit df1502e)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
jdevries3133 pushed a commit to jdevries3133/cpython that referenced this pull request Jun 19, 2021
…try_points_by_index (pythonGH-26784)

This avoids the following error if DeprecationWarnings are ignored.

    ======================================================================
    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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants