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.test_urllib2.HandlerTests.test_ftp_error fails without network access (running -u-network) #125584

Closed
mgorny opened this issue Oct 16, 2024 · 3 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@mgorny
Copy link
Contributor

mgorny commented Oct 16, 2024

Bug report

Bug description:

The newly added test_ftp_error (in 77133f5, FWICS) is failing in environments without Internet access, even though it is not marked as needing the "network" resource:

======================================================================
FAIL: test_ftp_error (test.test_urllib2.HandlerTests.test_ftp_error)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.14.0_alpha1/work/Python-3.14.0a1/Lib/urllib/request.py", line 1531, in ftp_open
    host = socket.gethostbyname(host)
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.14.0_alpha1/work/Python-3.14.0a1/Lib/test/test_urllib2.py", line 811, in test_ftp_error
    urlopen("ftp://www.pythontest.net/")
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-lang/python-3.14.0_alpha1/work/Python-3.14.0a1/Lib/urllib/request.py", line 489, in open
    response = self._open(req, data)
  File "/var/tmp/portage/dev-lang/python-3.14.0_alpha1/work/Python-3.14.0a1/Lib/urllib/request.py", line 506, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
                              '_open', req)
  File "/var/tmp/portage/dev-lang/python-3.14.0_alpha1/work/Python-3.14.0a1/Lib/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/var/tmp/portage/dev-lang/python-3.14.0_alpha1/work/Python-3.14.0a1/Lib/urllib/request.py", line 1533, in ftp_open
    raise URLError(msg)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.14.0_alpha1/work/Python-3.14.0a1/Lib/test/test_urllib2.py", line 813, in test_ftp_error
    self.assertEqual(raised.reason,
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
                     f"ftp error: {exception.args[0]}")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: gaierror(-3, 'Temporary failure in name resolution') != 'ftp error: 500 OOPS: cannot change directory:/nonexistent'

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

@mgorny mgorny added the type-bug An unexpected behavior, bug, or error label Oct 16, 2024
@Eclips4 Eclips4 added the tests Tests in the Lib/test dir label Oct 16, 2024
@Eclips4
Copy link
Member

Eclips4 commented Oct 16, 2024

Hello!
Thanks for the report. Would you like to send a PR with fix?

@mgorny
Copy link
Contributor Author

mgorny commented Oct 16, 2024

Sure, I can try making one in a minute.

@mgorny
Copy link
Contributor Author

mgorny commented Oct 16, 2024

Filed #125586 for it.

mgorny added a commit to mgorny/cpython that referenced this issue Oct 16, 2024
@Eclips4 Eclips4 closed this as completed Oct 16, 2024
befeleme pushed a commit to fedora-python/cpython that referenced this issue Oct 17, 2024
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 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants