Skip to content

Conversation

Copy link

Copilot AI commented Jan 15, 2026

The parametrize_with_checks_slow decorator was missing the generate_only parameter that sklearn's check_estimator expects in version 1.4.2, causing TypeError: got an unexpected keyword argument 'generate_only' when test code attempted to pass it.

Changes

  • Function signature: Added generate_only=True parameter with default value for backward compatibility
  • Parameter pass-through: Forward generate_only to sklearn.utils.estimator_checks.check_estimator calls instead of hardcoding True
  • Documentation: Added docstring documenting all parameters
# Before
def parametrize_with_checks_slow(fast_arguments, slow_arguments):
    fast_params = [
        list(sklearn.utils.estimator_checks.check_estimator(
            fast_arg, generate_only=True))[0] for fast_arg in fast_arguments
    ]
    ...

# After
def parametrize_with_checks_slow(fast_arguments, slow_arguments, generate_only=True):
    """Parametrize tests with sklearn estimator checks, supporting fast/slow test modes."""
    fast_params = [
        list(sklearn.utils.estimator_checks.check_estimator(
            fast_arg, generate_only=generate_only))[0] for fast_arg in fast_arguments
    ]
    ...

Existing callers continue to work unchanged using the default value.

Original prompt

Update the parametrize_with_checks_slow decorator to accept and properly handle the generate_only argument.

Currently the decorator in tests/_util.py does not accept a generate_only parameter, but usages in the test suite expect to provide it, which causes a TypeError: got an unexpected keyword argument 'generate_only' (see failing logs from Job 60500166432).

Task:

  • Update the function signature of parametrize_with_checks_slow to accept a generate_only argument (default=True for backward compatibility).
  • Ensure generate_only is passed through to sklearn.utils.estimator_checks.check_estimator inside the function.
  • Confirm usage in test code (such as in tests/test_sklearn.py) is compatible and safe, and update the docstring if present to mention the new argument.

Example implementation:

def parametrize_with_checks_slow(fast_arguments, slow_arguments, generate_only=True):
    fast_params = [
        list(sklearn.utils.estimator_checks.check_estimator(
            fast_arg, generate_only=generate_only))[0] for fast_arg in fast_arguments
    ]
    slow_params = [
        list(sklearn.utils.estimator_checks.check_estimator(
            slow_arg, generate_only=generate_only))[0] for slow_arg in slow_arguments
    ]
    return parametrize_slow("estimator,check", fast_params, slow_params)

This enables user code to pass generate_only without errors and resolves the CI/test failures due to this issue.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

Thank you for your contribution. We require contributors to sign our Contributor License Agreement (CLA). We do not have a signed CLA on file for you. In order for us to review and merge your code, please sign our CLA here. After you signed, you can comment on this PR with @cla-bot check to trigger another check.

Co-authored-by: MMathisLab <28102185+MMathisLab@users.noreply.github.com>
@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

Thank you for your contribution. We require contributors to sign our Contributor License Agreement (CLA). We do not have a signed CLA on file for you. In order for us to review and merge your code, please sign our CLA here. After you signed, you can comment on this PR with @cla-bot check to trigger another check.

Copilot AI changed the title [WIP] Update parametrize_with_checks_slow to accept generate_only argument Add generate_only parameter to parametrize_with_checks_slow decorator Jan 15, 2026
Copilot AI requested a review from MMathisLab January 15, 2026 18:05
@MMathisLab MMathisLab requested a review from stes January 15, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants