Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9521f79

Browse files
authored
TST Handle Connection error in test_load_boston_alternative (#21178)
1 parent 26ed0a2 commit 9521f79

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sklearn/datasets/tests/test_base.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@ def test_load_boston_alternative():
341341
boston_sklearn = load_boston()
342342

343343
data_url = "http://lib.stat.cmu.edu/datasets/boston"
344-
raw_df = pd.read_csv(data_url, sep=r"\s+", skiprows=22, header=None)
344+
try:
345+
raw_df = pd.read_csv(data_url, sep=r"\s+", skiprows=22, header=None)
346+
except ConnectionError as e:
347+
pytest.xfail(f"The dataset can't be downloaded. Got exception: {e}")
345348
data = np.hstack([raw_df.values[::2, :], raw_df.values[1::2, :2]])
346349
target = raw_df.values[1::2, 2]
347350

0 commit comments

Comments
 (0)