Skip to content
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

TST/PKG: Remove definition pandas.util.testing.slow #16850

Closed
TomAugspurger opened this issue Jul 7, 2017 · 2 comments · Fixed by #16852
Closed

TST/PKG: Remove definition pandas.util.testing.slow #16850

TomAugspurger opened this issue Jul 7, 2017 · 2 comments · Fixed by #16852
Labels
Testing pandas testing functions or related to the test suite
Milestone

Comments

@TomAugspurger
Copy link
Contributor

And just use pytest.mark.slow where needed. Defining the fixture at the top-level there causes problems for projects that import pandas and use the --strict flag for pytest.

$ echo "import pandas" > test_pandas.py
$ pytest test_pandas.py --strict

====================================================== ERRORS ======================================================
_________________________________________ ERROR collecting test_pandas.py __________________________________________
test_pandas.py:1: in <module>
    import pandas
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/__init__.py:60: in <module>
    import pandas.testing
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/testing.py:7: in <module>
    from pandas.util.testing import (
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/util/testing.py:55: in <module>
    slow = pytest.mark.slow
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/_pytest/mark.py:251: in __getattr__
    self._check(name)
/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/_pytest/mark.py:266: in _check
    raise AttributeError("%r not a registered marker" % (name,))
E   AttributeError: 'slow' not a registered marker
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================= 1 error in 1.29 seconds ==============================================

By replacing usages of @slow with @pytest.mark.slow, the error is not raised.

The alternative is to register a setuptools entrypoint that exposes the slow marker. I don't think this is desirable, since AFAIK, there's no namespacing on pytest plugins. It doesn't make since for pandas to claim that, since we aren't a pytest plugin really.

I'm marking this for 0.21.0, since it's possible people were using the @slow decorator in their own tests. I'll do some searching.

xref #16680 (comment) and #16797

cc @koffie

@TomAugspurger TomAugspurger added the Testing pandas testing functions or related to the test suite label Jul 7, 2017
@TomAugspurger TomAugspurger added this to the 0.21.0 milestone Jul 7, 2017
@GergelyKalmar
Copy link

wow, I was just bitten by this very issue a couple of minutes ago. is there any workaround that I could deploy for 0.20.3 to avoid breaking pytest --strict runs when importing pandas?

@TomAugspurger
Copy link
Contributor Author

@GergelyKalmar you could probably add the pandas conftest to your search path when you start pytest, though that may break other things.

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 a pull request may close this issue.

2 participants