Unverified Commit 27dcf820 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[docs] [ci] skip scikit-learn 1.7.1 in docs build, make tests compatible with...

[docs] [ci] skip scikit-learn 1.7.1 in docs build, make tests compatible with pandas 3.0, use new Azure DevOps pool (#6979)
parent a0fde1b0
......@@ -53,7 +53,7 @@ jobs:
# Maintenance #
###############
- job: Maintenance
pool: lgb_agent_pool_ado
pool: lightgbm_agent_pool_ado
container: ubuntu-latest
# routine maintenance (like periodically deleting old files),
# to be run on 1 random CI runner in the self-hosted pool each runner
......@@ -90,7 +90,7 @@ jobs:
SETUP_CONDA: 'false'
OS_NAME: 'linux'
PRODUCES_ARTIFACTS: 'true'
pool: lgb_agent_pool_ado
pool: lightgbm_agent_pool_ado
container: linux-artifact-builder
strategy:
matrix:
......@@ -157,7 +157,7 @@ jobs:
IN_UBUNTU_BASE_CONTAINER: 'true'
OS_NAME: 'linux'
SETUP_CONDA: 'true'
pool: lgb_agent_pool_ado
pool: lightgbm_agent_pool_ado
container: ubuntu-latest
strategy:
matrix:
......
......@@ -13,6 +13,7 @@ dependencies:
- r-matrix=1.6_5
- r-pkgdown=2.1.1
- r-roxygen2=7.3.2
- scikit-learn>=1.6.1
# skipping scikit-learn 1.7.1 because of the problems described in https://github.com/microsoft/LightGBM/issues/6978
- scikit-learn>=1.6.1,!=1.7.1
- sphinx>=8.1.3
- sphinx_rtd_theme>=3.0.1
......@@ -678,10 +678,22 @@ def test_list_to_1d_numpy(collection, dtype, rng):
custom_name = "my_custom_variable"
if collection.startswith("pd"):
if not PANDAS_INSTALLED:
pytest.skip("pandas is not installed")
else:
pd = pytest.importorskip("pandas")
y = pd_Series(y)
if pd.api.types.is_object_dtype(y):
with pytest.raises(
ValueError,
match=r"pandas dtypes must be int, float or bool\.\nFields with bad pandas dtypes: 0: object",
):
lgb.basic._list_to_1d_numpy(y, dtype=np.float32, name=custom_name)
return
elif pd.api.types.is_string_dtype(y):
with pytest.raises(
ValueError, match=r"pandas dtypes must be int, float or bool\.\nFields with bad pandas dtypes: 0: str"
):
lgb.basic._list_to_1d_numpy(y, dtype=np.float32, name=custom_name)
return
if isinstance(y, np.ndarray) and len(y.shape) == 2:
with pytest.warns(UserWarning, match="column-vector"):
lgb.basic._list_to_1d_numpy(y, dtype=np.float32, name=custom_name)
......@@ -694,12 +706,7 @@ def test_list_to_1d_numpy(collection, dtype, rng):
with pytest.raises(TypeError, match=err_msg):
lgb.basic._list_to_1d_numpy(y, dtype=np.float32, name=custom_name)
return
elif isinstance(y, pd_Series) and y.dtype == object:
with pytest.raises(
ValueError, match=r"pandas dtypes must be int, float or bool\.\nFields with bad pandas dtypes: 0: object"
):
lgb.basic._list_to_1d_numpy(y, dtype=np.float32, name=custom_name)
return
result = lgb.basic._list_to_1d_numpy(y, dtype=dtype, name=custom_name)
assert result.size == 10
assert result.dtype == dtype
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment