Skip to content

PKG/DEP: Make importable without pytest #16088

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
Apr 21, 2017

Conversation

TomAugspurger
Copy link
Contributor

@TomAugspurger TomAugspurger commented Apr 21, 2017

Closes #16065

Edit: removed the top-level imports of pytest in pandas.util.testing

@TomAugspurger TomAugspurger added the Dependencies Required and optional dependencies label Apr 21, 2017
@TomAugspurger TomAugspurger added this to the 0.20.0 milestone Apr 21, 2017
@TomAugspurger
Copy link
Contributor Author

Actually, thinking more about this I probably prefer removing the line from panads.init and have people import it separately

import pandas.testing as tm

@chris-b1
Copy link
Contributor

chris-b1 commented Apr 21, 2017

Since pytest isn't actually needed for the api functions (assert_frame_equal, etc), maybe those could be defined in pandas.testing, then imported back into pandas.util.testing?

edit: actually this is lot less trivial than I was originally thinking, so maybe not a good idea

@chris-b1
Copy link
Contributor

Looking at testing.py again - almost every use pytest already has function level imports, so may be best to bite the bullet and do it for the few remaining cases?

@TomAugspurger
Copy link
Contributor Author

so may be best to bite the bullet and do it for the few remaining cases?

OK, let me give this a shot.

@codecov
Copy link

codecov bot commented Apr 21, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@2f9c854). Click here to learn what that means.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #16088   +/-   ##
=========================================
  Coverage          ?   90.84%           
=========================================
  Files             ?      159           
  Lines             ?    50780           
  Branches          ?        0           
=========================================
  Hits              ?    46132           
  Misses            ?     4648           
  Partials          ?        0
Flag Coverage Δ
#multiple 88.62% <66.66%> (?)
#single 40.36% <50%> (?)
Impacted Files Coverage Δ
pandas/util/testing.py 79.5% <66.66%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f9c854...ed1ca67. Read the comment docs.

@TomAugspurger
Copy link
Contributor Author

Ok, not too bad at all. Hopefully this passes.

And here it is working without pytest, which is nice

In [1]: import pandas as pd

In [2]: pd.testing.assert_series_equal(pd.Series([1]), pd.Series([2]))
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-2-46d7e85da706> in <module>()
----> 1 pd.testing.assert_series_equal(pd.Series([1]), pd.Series([2]))

/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/util/testing.py in assert_series_equal(left, right, check_dtype, check_index_type, check_series_type, check_less_precise, check_names, check_exact, check_datetimelike_compat, check_categorical, obj)
   1310                                        check_less_precise=check_less_precise,
   1311                                        check_dtype=check_dtype,
-> 1312                                        obj='{0}'.format(obj))
   1313
   1314     # metadata comparison

as/pandas/util/testing.pyx in pandas.util.libtesting.assert_almost_equal (pandas/util/testing.c:4156)()

as/pandas/util/testing.pyx in pandas.util.libtesting.assert_almost_equal (pandas/util/testing.c:3274)()

/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/util/testing.py in raise_assert_detail(obj, message, left, right, diff)
   1137         msg = msg + "\n[diff]: {diff}".format(diff=diff)
   1138
-> 1139     raise AssertionError(msg)
   1140
   1141

AssertionError: Series are different

Series values are different (100.0 %)
[left]:  [1]
[right]: [2]

@jreback
Copy link
Contributor

jreback commented Apr 21, 2017

@TomAugspurger btw, make sure you can locally conda build (or pip), install into a fresh env and do a
python -c "import pandas; pandas.test()" works (we tests this on travis, but this is a check).

also after you tag, but before pushing, make sure the same works for the __version__

@TomAugspurger TomAugspurger mentioned this pull request Apr 21, 2017
@jreback jreback merged commit 70ae817 into pandas-dev:master Apr 21, 2017
@jreback
Copy link
Contributor

jreback commented Apr 21, 2017

thanks @TomAugspurger

@TomAugspurger TomAugspurger deleted the no-pytest branch May 1, 2017 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies Required and optional dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants