Skip to content

Conversation

@WillAyd
Copy link
Member

@WillAyd WillAyd commented Dec 19, 2017

This should be the last commit to close out the issue referenced above. I think there's further opportunity to convert some of the imperative pytest.skip calls over to the new decorator methodology (especially Ibn pandas/tests/io) but to keep the scope clean I would rather open a new issue for those rather than continually update #18190

import scipy
if (spmatrix is scipy.sparse.dok_matrix and LooseVersion(
scipy.__version__) >= LooseVersion('0.19.0')):
pytest.skip("dok_matrix from object does not work in SciPy >= 0.19")
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a slightly different take on the existing code, which was the only place I saw the max_version argument being used. Rather than re-build that in the new module, I changed this around to be more explicit about the issue encountered when running this for SciPy v > 0.19.

Note that all of the scenarios in this test issue the warning that"object dtype is not supported by sparse matrices"

@WillAyd
Copy link
Member Author

WillAyd commented Dec 19, 2017

Looking into Travis failures. I was only grepping the pandas directory for skip_if_no uses but looks like I missed some in conftest.py

@gfyoung gfyoung added the Testing pandas testing functions or related to the test suite label Dec 19, 2017

@pytest.fixture(params=['bsr', 'coo', 'csc', 'csr', 'dia', 'dok', 'lil'])
def spmatrix(request):
tm._skip_if_no_scipy()
Copy link
Member

Choose a reason for hiding this comment

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

Why can we just remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Instead of calling it imperatively I replaced it with decorators in the test functions that were using this fixture

Copy link
Member

Choose a reason for hiding this comment

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

Hmm...I think that we should still skip within the resource if it cannot be used. It is more decoupled that way IMO.

Copy link
Member Author

Choose a reason for hiding this comment

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

So you'd rather remove the decorator and keep it to the fixture to skip tests? Or do both and live with the duplication? I'd argue either one violates TMTOWTDI given the former would make this inconsistent with other SciPy-requiring tests that don't need this fixture (which are the majority). Not to mention it would defeat the purpose of the original issue. The latter violation should be self-evident.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah this is ok

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough. You could just do scipy = pytest.importorskip(...), but if we're okay with leaving it to the developer to be mindful of that dependency, sure.

pytest.raises(ValueError, store.put, 'b', df,
format='fixed', complib='zlib')

@td.skip_if_no('tables', min_version='2.2')
Copy link
Contributor

Choose a reason for hiding this comment

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

actually you can remove this, we require tables >= 3.0

Copy link
Member Author

@WillAyd WillAyd Dec 20, 2017

Choose a reason for hiding this comment

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

Removed altogether in last push - the module-level importorskip already prevents this from being run without pytables

@jreback jreback added this to the 0.23.0 milestone Dec 21, 2017
@jreback jreback merged commit a03bb08 into pandas-dev:master Dec 21, 2017
@jreback
Copy link
Contributor

jreback commented Dec 21, 2017

thanks @WillAyd very nice set of patches!

@WillAyd WillAyd deleted the dec-cleanup branch December 21, 2017 15:06
@jorisvandenbossche
Copy link
Member

@WillAyd General comment, please give your PRs a bit more descriptive title (@jreback please also do that before merging so the commit title is more informative when looking at the log)

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.

TST: make _skip_if into pytest decorators

4 participants