-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Description
Context
Currently most implementations are tested against 64bit datasets only. The re-factoring of some internals for computations on 32bit datasets brought the need to test user-facing interfaces on 32bit datasets (see #22590 (comment)). A few group of PRs (such as #22663) introduced a simple parametrisation on dtype
:
# ...
DTYPES = (np.float32, np.float64)
# ...
@pytest.mark.parametrize("dtype", DTYPES)
def test(dtype):
# ...
Problem
Yet, parametrising tests on dtype
might just make running the test suite (much) longer. Hence, we could add an option to be able to run such tests for 32bit data optionally. In this case, we also need to have a way to specify this option so that it can be triggered on the CI.
Proposed solution
We can keep the tests parametrisation on dtype
as proposed in PRs (such as #22663) but have the value of DTYPES
be specified globally (e.g. in sklearn/utils/_testing.py
) and adaptively on the value environement variable. Naively:
# sklearn/utils/_testing.py
# ...
DTYPES = [np.float64]
if os.environ.get("SKLEARN_RUN_32BIT_TESTS"):
DTYPES.append(np.float32)
As for the CI, we could have a new [test 32bit]
commit message marker which would define this environement variable.