From 8959622836a5e6ca85b759621722e8181fb222b9 Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Wed, 13 Jul 2022 11:59:02 +0800 Subject: [PATCH] [dask] Use an invalid port for test. (#8064) --- tests/python/test_with_dask.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/python/test_with_dask.py b/tests/python/test_with_dask.py index a023112321e7..67d6ea97ea6f 100644 --- a/tests/python/test_with_dask.py +++ b/tests/python/test_with_dask.py @@ -1,6 +1,7 @@ """Copyright 2019-2022 XGBoost contributors""" from pathlib import Path import pickle +import socket import testing as tm import pytest import xgboost as xgb @@ -1243,11 +1244,11 @@ def after_iteration( os.remove(after_fname) with dask.config.set({'xgboost.foo': "bar"}): - with pytest.raises(ValueError): + with pytest.raises(ValueError, match=r"Unknown configuration.*"): xgb.dask.train(client, {}, dtrain, num_boost_round=4) - with dask.config.set({'xgboost.scheduler_address': "127.0.0.1:22"}): - with pytest.raises(PermissionError): + with dask.config.set({'xgboost.scheduler_address': "127.0.0.1:foo"}): + with pytest.raises(socket.gaierror, match=r".*not known.*"): xgb.dask.train(client, {}, dtrain, num_boost_round=1) def run_updater_test(