Skip to content

Commit 602dc0a

Browse files
authored
Adress pytest socketblocked exception issues (#2324)
### What kind of change does this PR introduce? * Sets `SocketBlockedError` to a subset of the `Exception` class, so that if ever it is encountered while `pytest-socket` is not installed (e.g. in downstream libraries), it doesn't error out during failed HTTP requests ### Does this PR introduce a breaking change? No. ### Other information: This should make it so that downstream libraries do not require `pytest-socket`, but can still make use of it if they wish to. Credit for this solution is owed to @aulemahal.
2 parents 338bed9 + d0003e7 commit 602dc0a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Changelog
44

55
v0.61.0 (unreleased)
66
--------------------
7-
Contributors to this version: Pascal Bourgault (:user:`aulemahal`).
7+
Contributors to this version: Pascal Bourgault (:user:`aulemahal`), Trevor James Smith (:user:`Zeitsperre`).
88

99
New indicators and features
1010
^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -18,6 +18,7 @@ Internal changes
1818
* Updated the ReadTheDocs configuration to build docs with an older Python version and a newer conda version.
1919
* Updated the `pre-commit` hooks (`check-jsonschema`) in order to accept the latest supported conda version in ReadTheDocs config.
2020
* Set ``docs/conf.py`` to ignore `sphinx_autodoc_typehints.guarded_import` errors raised by `xarray` type guarding.
21+
* Set `SocketBlockedError` to be a subset of the `Exception` class when `pytest-socket` is not installed. (:pull:`2324`).
2122

2223
v0.60.0 (2026-01-23)
2324
--------------------

src/xclim/testing/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@
3939
from pytest_socket import SocketBlockedError
4040
except ImportError:
4141
pytest = None
42-
SocketBlockedError = None
42+
43+
class SocketBlockedError(Exception):
44+
pass
45+
4346

4447
try:
4548
import pooch

0 commit comments

Comments
 (0)