diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b0d878b358..bd230ac3e87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +### Fixed +- Fix pytest 9 compatibility: use `collection_path` instead of deprecated `path` argument in `pytest_ignore_collect` hook +- Fix NumPy 2.0 compatibility: use `method` instead of deprecated `interpolation` in `np.percentile` and `np.isin` instead of `np.in1d` + ## [6.5.2] - 2026-01-14 ### Fixed diff --git a/plotly/conftest.py b/plotly/conftest.py index 1e1361dd518..bcea2a16be7 100644 --- a/plotly/conftest.py +++ b/plotly/conftest.py @@ -1,7 +1,8 @@ import os +from pathlib import Path -def pytest_ignore_collect(path): +def pytest_ignore_collect(collection_path: Path): # Ignored files, most of them are raising a chart studio error ignored_paths = [ "exploding_module.py", @@ -16,9 +17,10 @@ def pytest_ignore_collect(path): "presentation_objs.py", "session.py", ] + path_str = str(collection_path) if ( - os.path.basename(str(path)) in ignored_paths - or "plotly/plotly/plotly/__init__.py" in str(path) - or "plotly/api/utils.py" in str(path) + collection_path.name in ignored_paths + or "plotly/plotly/plotly/__init__.py" in path_str + or "plotly/api/utils.py" in path_str ): return True diff --git a/plotly/figure_factory/_violin.py b/plotly/figure_factory/_violin.py index 55924e69238..285733fefd8 100644 --- a/plotly/figure_factory/_violin.py +++ b/plotly/figure_factory/_violin.py @@ -17,9 +17,9 @@ def calc_stats(data): x = np.asarray(data, float) vals_min = np.min(x) vals_max = np.max(x) - q2 = np.percentile(x, 50, interpolation="linear") - q1 = np.percentile(x, 25, interpolation="lower") - q3 = np.percentile(x, 75, interpolation="higher") + q2 = np.percentile(x, 50, method="linear") + q1 = np.percentile(x, 25, method="lower") + q3 = np.percentile(x, 75, method="higher") iqr = q3 - q1 whisker_dist = 1.5 * iqr diff --git a/tests/test_optional/test_px/test_px.py b/tests/test_optional/test_px/test_px.py index 6c65925a727..a74c4680540 100644 --- a/tests/test_optional/test_px/test_px.py +++ b/tests/test_optional/test_px/test_px.py @@ -36,7 +36,7 @@ def test_custom_data_scatter(backend): ) for data in fig.data: assert np.all( - np.in1d(data.customdata[:, 1], iris.get_column("petal_width").to_numpy()) + np.isin(data.customdata[:, 1], iris.get_column("petal_width").to_numpy()) ) # Hover and custom data, no repeated arguments fig = px.scatter( diff --git a/tests/test_optional/test_px/test_px_functions.py b/tests/test_optional/test_px/test_px_functions.py index 0814898f89d..8220ec7a33a 100644 --- a/tests/test_optional/test_px/test_px_functions.py +++ b/tests/test_optional/test_px/test_px_functions.py @@ -307,7 +307,7 @@ def test_sunburst_treemap_with_path_color(constructor): fig = px.sunburst( df.to_native(), path=path, color="sectors", color_discrete_map=cmap ) - assert np.all(np.in1d(fig.data[0].marker.colors, list(cmap.values()))) + assert np.all(np.isin(fig.data[0].marker.colors, list(cmap.values()))) # Numerical column in path df = (