Skip to content

TEST Add pytest marker for narwhals #1555

Closed

Description

@FBruzzesi

Description

This might look like an odd request, but please bear with me.
In Narwhals we take some effort to make sure that what we release/merge does not end up breaking downstream libraries that use Narwhals. We run tests of these libraries as part of our usual CI with Narwhals installing from the PR codebase (see downstream_tests.yaml).

For some libraries, these test might take a while and we end up running only specific tests (see darts example).
In a way this is a hack which might break easily in (at least) the following two scenarios:

  • A test is moved -> breaks our CI (happened with plotly)
  • A new test is added and we don't run it -> silent "failure"

I would consider Fairlearn to be among the libraries which tests can be quite long in their entirety.


In light of the progressive Narwhals adoption in Fairlearn, I am here to ask what should we test, that also runs in reasonable time.

Would the minimal-deps test suffice? Will there be in the future parts of the code outside of what's tested with minimal-deps workflow that use Narwhals, either directly or indirectly?

One idea would be to add a pytestmark = pytest.mark.narwhals at the top of the test files that run with Narwhals.
In this way we simply run pytest test -m narwhals to collect all and only these tests, without the need to change it over time.

Let me know if this is a viable idea.


Narwhals issue to track it: narwhals#2603

Activity

  1. changed the title [-]TEST Add pytest narwhals marker[/-] [+]TEST Add pytest marker for narwhals[/+] on May 27, 2025
  2. taharallouche commented on Oct 21, 2025

    @taharallouche
    Member

    I would consider Fairlearn to be among the libraries which tests can be quite long in their entirety.

    Agreed 💯 (I'm working on speeding them up 🤞)

    One idea would be to add a pytestmark

    I'm ok with this solution, it would resolve the first breaking case you mentionned (a test is moved), and the second one too (silent failures) provided that we do not forget to mark new narwhals related tests 👍

    @fairlearn/fairlearn-maintainers Any objections ? I guess that in practice this would involve:

    • registring the marker in our pytest config.
    • marking some files as @FBruzzesi suggests, (or some specific tests with @pytest.mark.narwhals at the top)
  3. TamaraAtanasoska commented on Oct 21, 2025

    @TamaraAtanasoska
    Contributor

    I am also in favour of this, it makes sense for both sides. Maybe we can do a check if a test is added/changed to have a tag like we have for the changelog so we don't forget? "not a narwhals test"

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