Skip to content

TST: only catch deprecation warnings for top-level module imports #15718

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

Merged
merged 1 commit into from
Mar 17, 2017

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Mar 17, 2017

No description provided.

@jreback jreback added the Testing pandas testing functions or related to the test suite label Mar 17, 2017
@jreback jreback added this to the 0.20.0 milestone Mar 17, 2017
@jreback jreback merged commit d968260 into pandas-dev:master Mar 17, 2017
@jorisvandenbossche
Copy link
Member

@jreback What is the rationale here? Whas there a certain problem? The fact that those raise a warning is useful to test, no?

@jreback
Copy link
Contributor Author

jreback commented Mar 20, 2017

well the problem is we have pandas.json, which if you are in pandas and do an import json it imports the local module (and not from the std library). So eventually when I get rid of pandas.json this will go away.

I put this in here, because you see the warning when the _version is imported.

@jorisvandenbossche
Copy link
Member

Sorry, I don't understand the connection between the import problem of json, and the fact that pd.json.dumps raises a FutureWarning ?

I put this in here, because you see the warning when the _version is imported.

Do you mean

In [1]: from pandas import _version

I don't see a warning there.

@jreback
Copy link
Contributor Author

jreback commented Mar 21, 2017

try creating a sdist, then untarring it. you will see a file pandas/_version.py, versioneer creates this.

IN this file it does a import json. BUT this is IN the pandas/ directory. guess what it picks up pandas.json. (it has always been this ways, and it just happens to work, because json.loads is works like the library one).

It actually loading the WRONG library. The deprecation warning is because we are deprecating pandas.json.

Its an unfortunate consequence of having a stdlib module name that is pretty common.

@jreback
Copy link
Contributor Author

jreback commented Mar 21, 2017

this ONLY happens on a package version FYI! It does NOT happen with a dev version. I noticed this when on the new build-test job, which actually does a full install then import pandas; pandas.test(), just like an end-user would do.

It shows a deprecation warning immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants