This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author carljm
Recipients carljm
Date 2021-03-19.21:21:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616188869.43.0.436044106244.issue43564@roundup.psfhosted.org>
In-reply-to
Content
In general it seems the CPython test suite takes care to skip instead of failing networked tests when the network is unavailable (c.f. `support.transient_internet` test helper).

In this case of the 5 FTP tests in `test_urllib2net` (that is, `test_ftp`, `test_ftp_basic`, `test_ftp_default_timeout`, `test_ftp_no_timeout`, and `test_ftp_timeout`), even though they use `support_transient_internet`, they still fail if the network is unavailable.

The reason is that they make calls which end up raising an exception in the form `URLError("ftp error: OSError(101, 'Network is unreachable')"` -- the original OSError is flattened into the exception string message, but is otherwise not in the exception args. This means that `transient_network` does not detect it as a suppressable exception.

It seems like many uses of `URLError` in urllib pass the original `OSError` directly to `URLError.__init__()`, which means it ends up in `args` and the unwrapping code in `transient_internet` is able to find the original `OSError`. But the ftp code instead directly interpolates the `OSError` into a new message string.
History
Date User Action Args
2021-03-19 21:21:09carljmsetrecipients: + carljm
2021-03-19 21:21:09carljmsetmessageid: <1616188869.43.0.436044106244.issue43564@roundup.psfhosted.org>
2021-03-19 21:21:09carljmlinkissue43564 messages
2021-03-19 21:21:09carljmcreate