8000 TST Add option to run tests on 32bit data · Issue #22680 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
TST Add option to run tests on 32bit data #22680
@jjerphan

Description

@jjerphan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Build / CIfloat32Issues related to support for 32bit datamodule:test-suiteeverything related to our testsworkflowDevelopment workflow changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0