-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
MAINT: Complete Conversion to Pytest Idiom #16201
MAINT: Complete Conversion to Pytest Idiom #16201
Conversation
f688e6b
to
96ca3be
Compare
|
@jreback : I don't really follow. What's the point of this comment? |
that shouldn't happen, that means a fixture is being used incorrectly. |
Yeah, there is some kind of cache poisoning somewhere, as when I check |
hmm, that could be. so you can relax / eliminate that test then. prob has to do with ordering of the cache insertions. |
But that cache insertion should never have happened though. I'm surprised that this only surfaced now (don't really see how my change would have caused it). |
Something goes wrong when you call >>> from pandas.core.dtypes.dtypes import IntervalDtype
>>> import pandas.util.testing as tm
>>>
>>> dtype = IntervalDtype("int64")
>>> IntervalDtype._cache
{'int64': interval[int64]}
>>>
>>> none_dtype = IntervalDtype("interval")
>>> IntervalDtype._cache
{'int64': interval[int64], 'None': interval}
>>>
>>> result = tm.round_trip_pickle(dtype)
>>> IntervalDtype._cache # what!?
{'int64': interval[int64], 'None': interval[int64]} A closer look indicates that there is aliasing going on in the cache. That's why the value mutates so mysteriously, which must happen when the pickled object is reloaded. This makes sense given that we are |
@jreback : What was the rationale for having a The other option is that we add a |
4e00445
to
2ba0a8f
Compare
i will fix |
Sorry, I should have said "unpickling," but okay, I will await a patch for the aliasing then. |
FYI merging #16207 shortly. you can pick up |
94bd4ab
to
51eab8c
Compare
Codecov Report
@@ Coverage Diff @@
## master #16201 +/- ##
==========================================
- Coverage 90.86% 90.23% -0.64%
==========================================
Files 162 162
Lines 50884 50883 -1
==========================================
- Hits 46237 45914 -323
- Misses 4647 4969 +322
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16201 +/- ##
==========================================
- Coverage 90.86% 90.24% -0.63%
==========================================
Files 162 162
Lines 50887 50882 -5
==========================================
- Hits 46240 45916 -324
- Misses 4647 4966 +319
Continue to review full report at Codecov.
|
51eab8c
to
fa7bdd9
Compare
@jreback : Circle is failing (see here), and I can't reproduce it. It seems like there is some kind of weird One thought is that we can try using |
84ad896
to
fa7bdd9
Compare
not sure. you should try rolling back parts of the change until this work. |
fbfa7c2
to
7ec9853
Compare
* tm.TestCase now just inherits from object * setUpClass renamed to setup_class * tearDownClass renamed to teardown_class * setUp renamed to setup_method * tearDown renamed to teardown_method
tm.TestCase no longer follows the nosetest idiom, so it is here to stay, so update the documentation to say that we are using it still. Closes pandas-devgh-15990.
The tm.mplskip decorator was breaking on Circle, so this commit removes the decorator and replaces it with direct function calls to check for matplotlib.
The only thing that |
9608307
to
7bed86a
Compare
NO, this is the entire point of this. as I said you can remove from everywhere except pandas/tests/frame & pandas/tests/indexing |
people are NEVER vigilant, assume that they aim to break every single rule :> |
But the default for chained assignment is "warning" - would that not surface in the build logs if tests were incorrectly written with chained assignment? |
tm.skip_if_no_ne(engine) | ||
skip_if_no_pandas_parser(parser) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can actually do this with a fixture skip, but no big deal really
ping when green. I have a PR after this one (moving stuff around). |
no its not for testing, its raise. |
But that's because you set it that way when you set up each test class. I meant in general, it's warning by default, hence my question. |
@jreback : All green and ready to go. |
but that's exactly the point. if someone writes a test that uses chained indexing I WANT it to fail the tests. Sure we can look for it, but its best to automatically catch it. |
thanks for this. |
What if we added it to |
hmm that might work actually |
I just gave it a shot, and I think it might work (here is code snippet) I'll make a PR for replace |
ok sounds good |
* MAINT: Convert test setup/teardown to pytest idiom * tm.TestCase now just inherits from object * setUpClass renamed to setup_class * tearDownClass renamed to teardown_class * setUp renamed to setup_method * tearDown renamed to teardown_method * MAINT: Remove unittest.TestCase from testing * DOC: Update documentation for TestCase usage tm.TestCase no longer follows the nosetest idiom, so it is here to stay, so update the documentation to say that we are using it still. Closes pandas-devgh-15990. * TST: Patch Circle matplotlib failure The tm.mplskip decorator was breaking on Circle, so this commit removes the decorator and replaces it with direct function calls to check for matplotlib. * TST: Replace yield-based tests in test_query_eval
* MAINT: Convert test setup/teardown to pytest idiom * tm.TestCase now just inherits from object * setUpClass renamed to setup_class * tearDownClass renamed to teardown_class * setUp renamed to setup_method * tearDown renamed to teardown_method * MAINT: Remove unittest.TestCase from testing * DOC: Update documentation for TestCase usage tm.TestCase no longer follows the nosetest idiom, so it is here to stay, so update the documentation to say that we are using it still. Closes pandas-devgh-15990. * TST: Patch Circle matplotlib failure The tm.mplskip decorator was breaking on Circle, so this commit removes the decorator and replaces it with direct function calls to check for matplotlib. * TST: Replace yield-based tests in test_query_eval
Version 0.20.0 * tag 'v0.20.0': (742 commits) RLS: v0.20.0 DOC: Whatsnew cleanup (pandas-dev#16245) TST: Test CategoricalIndex in test_is_categorical (pandas-dev#16243) TST: xfail some bottleneck on windows (pandas-dev#16240) DOC, TST: Document and Test Functions in dtypes/common.py (pandas-dev#16237) TST: Remove __init__ statements in testing (pandas-dev#16238) DOC: don't include all methods/attributes of IntervalIndex (pandas-dev#16221) PKG: Fix ModuleNotFoundError: No module named 'pandas.formats' (pandas-dev#16239) RLS: v0.20.0rc2 CLN: make submodules of pandas.util private (pandas-dev#16223) MAINT: Remove tm.TestCase from testing (pandas-dev#16225) MAINT: Complete Conversion to Pytest Idiom (pandas-dev#16201) DOC: add whatsnew for 0.21.0 DEPR: correct deprecation message for datetools (pandas-dev#16202) API Change repr name for table schema (pandas-dev#16204) DOC: Remove various warnings from doc build (pandas-dev#16206) DOC: add whatsnew for v0.20.1 BUG: Fixed renaming of falsey names in build_table_schema (pandas-dev#16205) COMPAT: ensure proper extension dtype's don't pickle the cache (pandas-dev#16207) REF: register custom DisplayFormatter for table schema (pandas-dev#16198) ...
pytest
idiomunittest.TestCase
tm.TestCase
Closes #15990.
pytest
idiom for test setup/teardown can be found here.