Skip to content

Commit 4d30a7f

Browse files
authored
Fix failing sklearn tests following release of pytest 9.0. (#21843)
A regression in pytest 9.0 causes `unittest.SkipTest` exceptions to not be handled anymore.
1 parent 19ca9c1 commit 4d30a7f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

keras/src/wrappers/sklearn_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests using Scikit-Learn's bundled estimator_checks."""
22

3+
import unittest
34
from contextlib import contextmanager
45

56
import pytest
@@ -156,5 +157,8 @@ def test_sklearn_estimator_checks(estimator, check):
156157
or "NotImplementedError" in str(exc)
157158
):
158159
pytest.xfail("Backend not implemented")
160+
elif isinstance(exc, unittest.SkipTest):
161+
# Workaround for https://github.com/pytest-dev/pytest/issues/13895
162+
pytest.skip(str(exc))
159163
else:
160164
raise

0 commit comments

Comments
 (0)