Skip to content

should doctests use print_changed_only=True? #13985

Closed

Description

@amueller

Regularly we have to change a lot of the doctests, in particular pretty unrelated parts, because we change default parameters.
I would argue that it would be better to use print_changed_only for all the doctests. That would have the positive effect of removing this extra overhead for devs.

It would also have the benefit of making examples more concise and easier to understand. If we demonstrate the setting of a particular parameter, it's easy to miss that particular parameter (or maybe it's hidden in the ellipsis even).

We can probably add a global fixture for this somewhere if we decide to do that.

Activity

  1. jnothman commented on May 30, 2019

    @jnothman
    Member

    +1

  2. NicolasHug commented on May 30, 2019

    @NicolasHug
    Member

    Looks like adding this to sklearn/conftest.py is what we want:

    @pytest.fixture(autouse=True)
    def print_changed_only(doctest_namespace):
        from sklearn import set_config  # put this at the top of the file instead
        set_config(print_changed_only=True)

    That would require changing all the existing doctests so it would be a big PR.

    I think we also want to add set_config(print_changed_only=True) in doc/conf.py for sphinx.

    Relevant docs

  3. thomasjpfan commented on May 30, 2019

    @thomasjpfan
    Member

    I am +1 on this.

  4. TomDLT commented on May 31, 2019

    @TomDLT
    Member

    +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions