gh-36696: Fix SSL timeout in doctest / internet feature
Recently I've been getting timeouts in a couple of doctests in
`src/sage/doctest/control.py`, including earlier today when testing
10.2.rc1
This has two causes:
1. The test for the internet feature doesn't catch a `TimeoutError`.
2. These two doctests cause internet feature to be tested.
The first one is clearly a bug: sagemath only expects
`urllib.error.URLError`, but in some cases urllib raises `TimeoutError`.
Arguably a bug in urlib, but easier to fix (or workaround) on our side.
Done in the first commit of this PR.
The second one is IMO a bug, since I didn't use `--optional=internet` no
test should hit internet (in particular, should not test internet
feature).
These two doctests are meant to test options `--hide=all` and
`--hide=optional`. For some reason the semantics of these include
testing for the internet feature. I believe the semantics of these
options should be similar to `--optional=all`, that is, exclude
"external" software (internet feature is considered "external").
That's what I implemented in the second commit in this PR.
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
URL: https://github.com/sagemath/sage/pull/36696
Reported by: Gonzalo TornarĂa
Reviewer(s):