Skip to content

BUG/BLD: pytest not a runtime dep #16065

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

Closed
chris-b1 opened this issue Apr 20, 2017 · 6 comments
Closed

BUG/BLD: pytest not a runtime dep #16065

chris-b1 opened this issue Apr 20, 2017 · 6 comments
Labels
Bug Build Library building on various platforms
Milestone

Comments

@chris-b1
Copy link
Contributor

on master - now that we've exposed a testing api, need to wrap the import of pytest

>>> import pandas

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Chris\Anaconda\envs\py361\lib\site-packages\pandas\__init__.py", line 60, in <module>
    import pandas.testing
  File "C:\Users\Chris\Anaconda\envs\py361\lib\site-packages\pandas\testing.py", line 7, in <module>
    from pandas.util.testing import (
  File "C:\Users\Chris\Anaconda\envs\py361\lib\site-packages\pandas\util\testing.py", line 22, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'
@chris-b1 chris-b1 added Bug Build Library building on various platforms labels Apr 20, 2017
@chris-b1 chris-b1 added this to the 0.20.0 milestone Apr 20, 2017
@jreback
Copy link
Contributor

jreback commented Apr 20, 2017

actually is there a reason we are doing an import pandas.testing at all in __init__?

@jorisvandenbossche ?

@jorisvandenbossche
Copy link
Member

Ah, good catch, but the testing functions do not depend on pytest, so this should be solvable (although maybe a bit annoying to move all imports of pytest inline ..)

actually is there a reason we are doing an import pandas.testing at all in init?

Because otherwise you cannot do pd.testing.assert_frame_equal, but have to explicitly import it (but I can certainly be wrong here!)

@jorisvandenbossche
Copy link
Member

Hmm, there is quite a lot of usage of pytest, so inline the import would be very annoying ..

So if you remove the line in init, you get this:

In [1]: pd.testing.assert_frame_equal
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-08ffb5740461> in <module>()
----> 1 pd.testing.assert_frame_equal

AttributeError: module 'pandas' has no attribute 'testing'

but have to explicitly import it like from pandas.testing import assert_frame_equal

@jorisvandenbossche
Copy link
Member

@jreback do you know how this does work for errors ? (because there directly assessing it does work)

@jreback
Copy link
Contributor

jreback commented Apr 20, 2017

but have to explicitly import it like from pandas.testing import assert_frame_equal

I don't think this is a big deal.

we explicity don't want to import the testings into the main namespace. It could be fixed to isolate, but maybe let's do that later.

@jreback
Copy link
Contributor

jreback commented Apr 20, 2017

@jreback do you know how this does work for errors ? (because there directly assessing it does work)

.errors defines things (or imports from cython libs).

I think we could do this in testing, but it would require hiding the pytest import & lots of other imports (prob not a big deal as they are std lib).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Build Library building on various platforms
Projects
None yet
Development

No branches or pull requests

3 participants