diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e0655a..1f1d8d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,9 @@ All notable changes to this driver. The format follows the reservation anyway: a retry then failed with "Kea rejected DHCP reservation" instead of the real error, or left two reservations for one address, which Kea refuses to load (#40). +- The unit tests no longer reach the network: the test of a failed `open()` looked + up a real host name and waited for the resolver, so it hung or behaved differently + on a build host with a slow resolver or one that answers every name (#41). ## [0.5.0] - 2026-10-23 diff --git a/tests/unit/test_driver.py b/tests/unit/test_driver.py index 9ce694b..c539b2d 100644 --- a/tests/unit/test_driver.py +++ b/tests/unit/test_driver.py @@ -132,8 +132,14 @@ class TestOpenClose: password="s", optional_args={"verify": False}, ) - with pytest.raises(ConnectionException): - drv.open() + refused = requests.exceptions.ConnectionError("Connection refused") + with patch.object(requests.Session, "get", side_effect=refused) as get: + with pytest.raises(ConnectionException, match="Connection refused"): + drv.open() + + get.assert_called_once() + assert get.call_args.args[0] == "https://unreachable.invalid/api/core/system/status" + assert drv.session is None def test_close_clears_session(self, driver): driver.close()