Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "REF: remove unnecessary na_value fixture" #54930

Merged

Conversation

jorisvandenbossche
Copy link
Member

This reverts one of the four commits of #54719.

While this was certainly a logical change to make (it's superfluous for our tests), it can give problems for downstream EAs (we got several failures in the geopandas' CI with pandas nightly), if they use None as their missing value.

The problem is that pandas didn't really support to properly set None as the ExtensionDtype.na_value (see eg #44602), and so we relied on the fixture to use the correct value for the tests while using the default of NaN for the attribute.

@jorisvandenbossche jorisvandenbossche added Testing pandas testing functions or related to the test suite ExtensionArray Extending pandas with custom dtypes or arrays. labels Sep 1, 2023
@jorisvandenbossche jorisvandenbossche added this to the 2.2 milestone Sep 1, 2023
@jbrockmendel
Copy link
Member

The problem is that pandas didn't really support to properly set None as the ExtensionDtype.na_value (see eg #44602), and so we relied on the fixture to use the correct value for the tests while using the default of NaN for the attribute.

Wouldn't actually addressing this be the correct solution?

@jorisvandenbossche
Copy link
Member Author

Yes, certainly, and we have a two year old open issue about it.

But nevertheless in the meantime it would be easier for downstream EAs that use None to keep the tests as they were

@jbrockmendel
Copy link
Member

But nevertheless in the meantime

Is this time-sensitive? Or just "before 2.2"? If the latter we should take some time to try to address the underlying issue.

Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's deprecate this then so that EA authors have time to adjust but we can clean it up at some point

@jorisvandenbossche
Copy link
Member Author

jorisvandenbossche commented Sep 13, 2023

Is this time-sensitive? Or just "before 2.2"? If the latter we should take some time to try to address the underlying issue.

It's "time sensitive" in the sense that it is annoying that we have a bunch of failing tests on our CI build with nightly pandas.

And I also don't see the issue with just merging this. We can easily change it back at some point when the issue is fixed (or tested, as it might already be fixed), although even then, we might want to wait a while with changing the test, as downstream EAs still test against multiple pandas versions typically.

@jorisvandenbossche
Copy link
Member Author

Let's deprecate this then

Do you mean to deprecate the pytest fixture? (not fully sure how that would work)

@jbrockmendel
Copy link
Member

I commented on #44602; I expect the geopandas problem is subtly different

@jorisvandenbossche
Copy link
Member Author

Yes, the problem for geopandas is that it supports multiple pandas versions, and this was only apparently fixed in a recent version.

@jbrockmendel
Copy link
Member

Yes, the problem for geopandas is that it supports multiple pandas versions, and this was only apparently fixed in a recent version.

Hmm i dont think we have a policy on the extension backward/forward compatibility of the extension tests. Tests in general I wouldn't expect to work with anything but the matching version.

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@jorisvandenbossche
Copy link
Member Author

Tests in general I wouldn't expect to work with anything but the matching version.

Of course the tests only work in the matching version, and downstream EA implementation import those tests from pandas, and thus in practice only test with matching versions.
But the issue here is not supporting the test across versions, but supporting the dtype na_value (i.e. #44602) across pandas version.

This PR is a very simple change, that makes the life easier for downstream testing in geopandas. So unless there is actual strong objection to do so, I am planning to merge this.

@jbrockmendel
Copy link
Member

But the issue here is not supporting the test across versions, but supporting the dtype na_value (i.e. #44602) across pandas version.

As I commented in #44602, that appears to be working without this kludge. IIUC you said the geopandas use case is working too. If geopandas wants to test against older pandas, they'll need to test against older versions of the extension tests. I don't see any way around that.

As you say this is a small change so I don't care that much. Is there a path to getting rid of this eventually? e.g. keep it around through 2.x and then re-remove it?

@jorisvandenbossche
Copy link
Member Author

As I commented in #44602, that appears to be working without this kludge. IIUC you said the geopandas use case is working too.

This is working for the latest version of pandas, but geopandas cannot yet adopt that because we support a range of pandas versions.

@jorisvandenbossche jorisvandenbossche merged commit b193ac5 into pandas-dev:main Nov 20, 2023
39 of 40 checks passed
@jorisvandenbossche jorisvandenbossche deleted the ea-test-na_value branch November 20, 2023 21:17
phofl pushed a commit to phofl/pandas that referenced this pull request Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays. Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants